Java 类net.minecraft.block.BlockPistonExtension 实例源码

项目:Backmemed    文件:TileEntityPiston.java   
public void func_190609_a(World p_190609_1_, BlockPos p_190609_2_, AxisAlignedBB p_190609_3_, List<AxisAlignedBB> p_190609_4_, @Nullable Entity p_190609_5_)
{
    if (!this.extending && this.shouldHeadBeRendered)
    {
        this.pistonState.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true)).addCollisionBoxToList(p_190609_1_, p_190609_2_, p_190609_3_, p_190609_4_, p_190609_5_, false);
    }

    EnumFacing enumfacing = (EnumFacing)field_190613_i.get();

    if ((double)this.progress >= 1.0D || enumfacing != (this.extending ? this.pistonFacing : this.pistonFacing.getOpposite()))
    {
        int i = p_190609_4_.size();
        IBlockState iblockstate;

        if (this.shouldPistonHeadBeRendered())
        {
            iblockstate = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.FACING, this.pistonFacing).withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(this.extending != 1.0F - this.progress < 0.25F));
        }
        else
        {
            iblockstate = this.pistonState;
        }

        float f = this.getExtendedProgress(this.progress);
        double d0 = (double)((float)this.pistonFacing.getFrontOffsetX() * f);
        double d1 = (double)((float)this.pistonFacing.getFrontOffsetY() * f);
        double d2 = (double)((float)this.pistonFacing.getFrontOffsetZ() * f);
        iblockstate.addCollisionBoxToList(p_190609_1_, p_190609_2_, p_190609_3_.offset(-d0, -d1, -d2), p_190609_4_, p_190609_5_, true);

        for (int j = i; j < p_190609_4_.size(); ++j)
        {
            p_190609_4_.set(j, ((AxisAlignedBB)p_190609_4_.get(j)).offset(d0, d1, d2));
        }
    }
}
项目:CrystalMod    文件:BlockCase.java   
@SuppressWarnings("deprecation")
@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_)
   {
    //super.addCollisionBoxToList(state, worldIn, pos, entityBox, collidingBoxes, entityIn, p_185477_7_);
       TileEntity tile = worldIn.getTileEntity(pos);

       if (tile != null && tile instanceof TileEntityCasePiston)
       {
        TileEntityCasePiston piston = (TileEntityCasePiston)tile;

        for(EnumFacing enumfacing : piston.validFaces){
            BlockPos pos2 = pos.offset(enumfacing);
            float progress = piston.progress[enumfacing.getIndex()];
            if (progress >= 1.0D)
            {
                IBlockState iblockstate;
                iblockstate = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockDirectional.FACING, enumfacing).withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(piston.isExtending[enumfacing.getIndex()] != 1.0F - progress < 0.25F));
                float f = piston.getExtendedProgress(progress, enumfacing);
                double d0 = enumfacing.getFrontOffsetX() * f;
                double d1 = enumfacing.getFrontOffsetY() * f;
                double d2 = enumfacing.getFrontOffsetZ() * f;
                iblockstate.addCollisionBoxToList(worldIn, pos2, entityBox.offset(-d0, -d1, -d2), collidingBoxes, entityIn, true);
            }
        }
       } 
       super.addCollisionBoxToList(state, worldIn, pos, entityBox, collidingBoxes, entityIn, p_185477_7_);
   }
项目:Easy-Editors    文件:BlockPropertyRegistry.java   
private static void registerVanillaVariantProps() {
    // TODO: omit similar blocks
    registerVariantProperty(BlockStone.VARIANT);
    registerVariantProperty(BlockPlanks.VARIANT);
    registerVariantProperty(BlockSapling.TYPE);
    registerVariantProperty(BlockDirt.VARIANT);
    registerVariantProperty(BlockSand.VARIANT);
    registerVariantProperty(BlockOldLog.VARIANT);
    registerVariantProperty(BlockNewLog.VARIANT);
    registerVariantProperty(BlockOldLeaf.VARIANT);
    registerVariantProperty(BlockNewLeaf.VARIANT);
    registerVariantProperty(BlockSandStone.TYPE);
    registerVariantProperty(BlockTallGrass.TYPE);
    registerVariantProperty(BlockPistonExtension.TYPE);
    registerVariantProperty(BlockColored.COLOR);
    registerVariantProperty(BlockPistonMoving.TYPE);
    registerVariantProperty(Blocks.YELLOW_FLOWER.getTypeProperty());
    registerVariantProperty(Blocks.RED_FLOWER.getTypeProperty());
    registerVariantProperty(BlockStoneSlab.VARIANT);
    registerVariantProperty(BlockWoodSlab.VARIANT);
    registerVariantProperty(BlockAnvil.DAMAGE);
    registerVariantProperty(BlockQuartz.VARIANT);
    registerVariantProperty(BlockCarpet.COLOR);
    registerVariantProperty(BlockDoublePlant.VARIANT);
    registerVariantProperty(BlockStainedGlass.COLOR);
    registerVariantProperty(BlockStainedGlassPane.COLOR);
    registerVariantProperty(BlockPrismarine.VARIANT);
    registerVariantProperty(BlockRedSandstone.TYPE);
    registerVariantProperty(BlockStoneSlabNew.VARIANT);
}
项目:DecompiledMinecraft    文件:TileEntityPistonRenderer.java   
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
    BlockPos blockpos = te.getPos();
    IBlockState iblockstate = te.getPistonState();
    Block block = iblockstate.getBlock();

    if (block.getMaterial() != Material.air && te.getProgress(partialTicks) < 1.0F)
    {
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        this.bindTexture(TextureMap.locationBlocksTexture);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.blendFunc(770, 771);
        GlStateManager.enableBlend();
        GlStateManager.disableCull();

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GlStateManager.shadeModel(7425);
        }
        else
        {
            GlStateManager.shadeModel(7424);
        }

        worldrenderer.begin(7, DefaultVertexFormats.BLOCK);
        worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX() + te.getOffsetX(partialTicks)), (double)((float)y - (float)blockpos.getY() + te.getOffsetY(partialTicks)), (double)((float)z - (float)blockpos.getZ() + te.getOffsetZ(partialTicks)));
        World world = this.getWorld();

        if (block == Blocks.piston_head && te.getProgress(partialTicks) < 0.5F)
        {
            iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
        }
        else if (te.shouldPistonHeadBeRendered() && !te.isExtending())
        {
            BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.sticky_piston ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT;
            IBlockState iblockstate1 = Blocks.piston_head.getDefaultState().withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonExtension.FACING, iblockstate.getValue(BlockPistonBase.FACING));
            iblockstate1 = iblockstate1.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate1, world, blockpos), iblockstate1, blockpos, worldrenderer, true);
            worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ()));
            iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
        }
        else
        {
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, false);
        }

        worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
项目:BaseClient    文件:TileEntityPistonRenderer.java   
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
    BlockPos blockpos = te.getPos();
    IBlockState iblockstate = te.getPistonState();
    Block block = iblockstate.getBlock();

    if (block.getMaterial() != Material.air && te.getProgress(partialTicks) < 1.0F)
    {
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        this.bindTexture(TextureMap.locationBlocksTexture);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.blendFunc(770, 771);
        GlStateManager.enableBlend();
        GlStateManager.disableCull();

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GlStateManager.shadeModel(7425);
        }
        else
        {
            GlStateManager.shadeModel(7424);
        }

        worldrenderer.begin(7, DefaultVertexFormats.BLOCK);
        worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX() + te.getOffsetX(partialTicks)), (double)((float)y - (float)blockpos.getY() + te.getOffsetY(partialTicks)), (double)((float)z - (float)blockpos.getZ() + te.getOffsetZ(partialTicks)));
        World world = this.getWorld();

        if (block == Blocks.piston_head && te.getProgress(partialTicks) < 0.5F)
        {
            iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
        }
        else if (te.shouldPistonHeadBeRendered() && !te.isExtending())
        {
            BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.sticky_piston ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT;
            IBlockState iblockstate1 = Blocks.piston_head.getDefaultState().withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonExtension.FACING, iblockstate.getValue(BlockPistonBase.FACING));
            iblockstate1 = iblockstate1.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate1, world, blockpos), iblockstate1, blockpos, worldrenderer, true);
            worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ()));
            iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
        }
        else
        {
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, false);
        }

        worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
项目:BaseClient    文件:TileEntityPistonRenderer.java   
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
    BlockPos blockpos = te.getPos();
    IBlockState iblockstate = te.getPistonState();
    Block block = iblockstate.getBlock();

    if (block.getMaterial() != Material.air && te.getProgress(partialTicks) < 1.0F)
    {
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        this.bindTexture(TextureMap.locationBlocksTexture);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.blendFunc(770, 771);
        GlStateManager.enableBlend();
        GlStateManager.disableCull();

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GlStateManager.shadeModel(7425);
        }
        else
        {
            GlStateManager.shadeModel(7424);
        }

        worldrenderer.begin(7, DefaultVertexFormats.BLOCK);
        worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX() + te.getOffsetX(partialTicks)), (double)((float)y - (float)blockpos.getY() + te.getOffsetY(partialTicks)), (double)((float)z - (float)blockpos.getZ() + te.getOffsetZ(partialTicks)));
        World world = this.getWorld();

        if (block == Blocks.piston_head && te.getProgress(partialTicks) < 0.5F)
        {
            iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
        }
        else if (te.shouldPistonHeadBeRendered() && !te.isExtending())
        {
            BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.sticky_piston ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT;
            IBlockState iblockstate1 = Blocks.piston_head.getDefaultState().withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonExtension.FACING, iblockstate.getValue(BlockPistonBase.FACING));
            iblockstate1 = iblockstate1.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate1, world, blockpos), iblockstate1, blockpos, worldrenderer, true);
            worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ()));
            iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
        }
        else
        {
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, false);
        }

        worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
项目:Backmemed    文件:TileEntityPistonRenderer.java   
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
    BlockPos blockpos = te.getPos();
    IBlockState iblockstate = te.getPistonState();
    Block block = iblockstate.getBlock();

    if (iblockstate.getMaterial() != Material.AIR && te.getProgress(partialTicks) < 1.0F)
    {
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer vertexbuffer = tessellator.getBuffer();
        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.enableBlend();
        GlStateManager.disableCull();

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GlStateManager.shadeModel(7425);
        }
        else
        {
            GlStateManager.shadeModel(7424);
        }

        vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
        vertexbuffer.setTranslation(x - (double)blockpos.getX() + (double)te.getOffsetX(partialTicks), y - (double)blockpos.getY() + (double)te.getOffsetY(partialTicks), z - (double)blockpos.getZ() + (double)te.getOffsetZ(partialTicks));
        World world = this.getWorld();

        if (block == Blocks.PISTON_HEAD && te.getProgress(partialTicks) <= 0.25F)
        {
            iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, true);
        }
        else if (te.shouldPistonHeadBeRendered() && !te.isExtending())
        {
            BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.STICKY_PISTON ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT;
            IBlockState iblockstate1 = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonExtension.FACING, iblockstate.getValue(BlockPistonBase.FACING));
            iblockstate1 = iblockstate1.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F));
            this.renderStateModel(blockpos, iblockstate1, vertexbuffer, world, true);
            vertexbuffer.setTranslation(x - (double)blockpos.getX(), y - (double)blockpos.getY(), z - (double)blockpos.getZ());
            iblockstate = iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, true);
        }
        else
        {
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, false);
        }

        vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
项目:Backmemed    文件:TileEntityPiston.java   
private IBlockState func_190606_j()
{
    return !this.isExtending() && this.shouldPistonHeadBeRendered() ? Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.TYPE, this.pistonState.getBlock() == Blocks.STICKY_PISTON ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT).withProperty(BlockPistonExtension.FACING, this.pistonState.getValue(BlockPistonBase.FACING)) : this.pistonState;
}
项目:CustomWorldGen    文件:TileEntityPistonRenderer.java   
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
    if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    BlockPos blockpos = te.getPos();
    IBlockState iblockstate = te.getPistonState();
    Block block = iblockstate.getBlock();

    if (iblockstate.getMaterial() != Material.AIR && te.getProgress(partialTicks) < 1.0F)
    {
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer vertexbuffer = tessellator.getBuffer();
        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.enableBlend();
        GlStateManager.disableCull();

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GlStateManager.shadeModel(7425);
        }
        else
        {
            GlStateManager.shadeModel(7424);
        }

        vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
        vertexbuffer.setTranslation((double)((float)x - (float)blockpos.getX() + te.getOffsetX(partialTicks)), (double)((float)y - (float)blockpos.getY() + te.getOffsetY(partialTicks)), (double)((float)z - (float)blockpos.getZ() + te.getOffsetZ(partialTicks)));
        World world = this.getWorld();

        if (block == Blocks.PISTON_HEAD && te.getProgress(partialTicks) < 0.5F)
        {
            iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, true);
        }
        else if (te.shouldPistonHeadBeRendered() && !te.isExtending())
        {
            BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.STICKY_PISTON ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT;
            IBlockState iblockstate1 = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonExtension.FACING, iblockstate.getValue(BlockPistonBase.FACING));
            iblockstate1 = iblockstate1.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F));
            this.renderStateModel(blockpos, iblockstate1, vertexbuffer, world, true);
            vertexbuffer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ()));
            iblockstate = iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, true);
        }
        else
        {
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, false);
        }

        vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
项目:CrystalMod    文件:TileEntityCasePiston.java   
private IBlockState getCollisionRelatedBlockState(EnumFacing side)
{
    return !isExtending[side.getIndex()] ? Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.TYPE, BlockPistonExtension.EnumPistonType.DEFAULT).withProperty(BlockDirectional.FACING, side) : getWorld().getBlockState(getPos());
}
项目:Structures    文件:RotationHelper.java   
private static BlockType getBlockType(Block block) {

    if(block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame
        || block instanceof BlockCocoa) {
      return BlockType.BED;
    }
    if(block instanceof BlockRail) {
      return BlockType.RAIL;
    }
    if(block instanceof BlockRailPowered || block instanceof BlockRailDetector) {
      return BlockType.RAIL_POWERED;
    }
    if(block instanceof BlockStairs) {
      return BlockType.STAIR;
    }
    if(block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder
        || block == Blocks.wall_sign) {
      return BlockType.CHEST;
    }
    if(block == Blocks.standing_sign) {
      return BlockType.SIGNPOST;
    }
    if(block instanceof BlockDoor) {
      return BlockType.DOOR;
    }
    if(block instanceof BlockButton) {
      return BlockType.BUTTON;
    }
    if(block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator) {
      return BlockType.REDSTONE_REPEATER;
    }
    if(block instanceof BlockTrapDoor) {
      return BlockType.TRAPDOOR;
    }
    if(block instanceof BlockHugeMushroom) {
      return BlockType.MUSHROOM_CAP;
    }
    if(block instanceof BlockVine) {
      return BlockType.VINE;
    }
    if(block instanceof BlockSkull) {
      return BlockType.SKULL;
    }
    if(block instanceof BlockAnvil) {
      return BlockType.ANVIL;
    }
    if(block instanceof BlockLog) {
      return BlockType.LOG;
    }
    if(block instanceof BlockDispenser || block instanceof BlockPistonBase || block instanceof BlockPistonExtension || block instanceof BlockHopper) {
      return BlockType.DISPENSER;
    }
    if(block instanceof BlockTorch) {
      return BlockType.TORCH;
    }
    if(block instanceof BlockLever) {
      return BlockType.LEVER;
    }
    if(block instanceof BlockTripWireHook) {
      return BlockType.TRIP_WIRE_HOOK;
    }

    return null;
  }
项目:ExpandedRailsMod    文件:TileEntityPistonRenderer.java   
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
    if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    BlockPos blockpos = te.getPos();
    IBlockState iblockstate = te.getPistonState();
    Block block = iblockstate.getBlock();

    if (iblockstate.getMaterial() != Material.AIR && te.getProgress(partialTicks) < 1.0F)
    {
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer vertexbuffer = tessellator.getBuffer();
        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.enableBlend();
        GlStateManager.disableCull();

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GlStateManager.shadeModel(7425);
        }
        else
        {
            GlStateManager.shadeModel(7424);
        }

        vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
        vertexbuffer.setTranslation((double)((float)x - (float)blockpos.getX() + te.getOffsetX(partialTicks)), (double)((float)y - (float)blockpos.getY() + te.getOffsetY(partialTicks)), (double)((float)z - (float)blockpos.getZ() + te.getOffsetZ(partialTicks)));
        World world = this.getWorld();

        if (block == Blocks.PISTON_HEAD && te.getProgress(partialTicks) < 0.5F)
        {
            iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, true);
        }
        else if (te.shouldPistonHeadBeRendered() && !te.isExtending())
        {
            BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.STICKY_PISTON ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT;
            IBlockState iblockstate1 = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonExtension.FACING, iblockstate.getValue(BlockPistonBase.FACING));
            iblockstate1 = iblockstate1.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F));
            this.renderStateModel(blockpos, iblockstate1, vertexbuffer, world, true);
            vertexbuffer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ()));
            iblockstate = iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, true);
        }
        else
        {
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, false);
        }

        vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}