当前位置: 首页>>代码示例>>Java>>正文


Java TileEntityPiston.getStoredBlockID方法代码示例

本文整理汇总了Java中net.minecraft.tileentity.TileEntityPiston.getStoredBlockID方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntityPiston.getStoredBlockID方法的具体用法?Java TileEntityPiston.getStoredBlockID怎么用?Java TileEntityPiston.getStoredBlockID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.tileentity.TileEntityPiston的用法示例。


在下文中一共展示了TileEntityPiston.getStoredBlockID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: storeTileEntity

import net.minecraft.tileentity.TileEntityPiston; //导入方法依赖的package包/类
public static void storeTileEntity(TileEntityPiston tePiston, NBTTagCompound teData) {
    if (teData != null) {
        Class c = tePiston.getClass();
        try {
            Field storedTileEntityData = c.getDeclaredField("storedTileEntityData");
            storedTileEntityData.set(tePiston, teData);

            // construct and cache a "dummy" te for rendering
            Field cachedTileEntity = c.getDeclaredField("cachedTileEntity");
            TileEntity cachedTE = TileEntity.createAndLoadEntity(teData);
            cachedTE.setWorldObj(tePiston.getWorldObj());
            cachedTE.blockMetadata = tePiston.getBlockMetadata();
            cachedTE.blockType = tePiston.getStoredBlockID();
            
            cachedTileEntity.set(tePiston, cachedTE);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:cheeseum-mods,项目名称:PistonEverything,代码行数:21,代码来源:PistonEverything.java

示例2: setBlockBoundsBasedOnState

import net.minecraft.tileentity.TileEntityPiston; //导入方法依赖的package包/类
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
{
    TileEntityPiston tileentitypiston = this.func_149963_e(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_);

    if (tileentitypiston != null)
    {
        Block block = tileentitypiston.getStoredBlockID();

        if (block == this || block.getMaterial() == Material.air)
        {
            return;
        }

        block.setBlockBoundsBasedOnState(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_);
        float f = tileentitypiston.func_145860_a(0.0F);

        if (tileentitypiston.isExtending())
        {
            f = 1.0F - f;
        }

        int l = tileentitypiston.getPistonOrientation();
        this.minX = block.getBlockBoundsMinX() - (double)((float)Facing.offsetsXForSide[l] * f);
        this.minY = block.getBlockBoundsMinY() - (double)((float)Facing.offsetsYForSide[l] * f);
        this.minZ = block.getBlockBoundsMinZ() - (double)((float)Facing.offsetsZForSide[l] * f);
        this.maxX = block.getBlockBoundsMaxX() - (double)((float)Facing.offsetsXForSide[l] * f);
        this.maxY = block.getBlockBoundsMaxY() - (double)((float)Facing.offsetsYForSide[l] * f);
        this.maxZ = block.getBlockBoundsMaxZ() - (double)((float)Facing.offsetsZForSide[l] * f);
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:31,代码来源:BlockPistonMoving.java

示例3: setBlockBoundsBasedOnState

import net.minecraft.tileentity.TileEntityPiston; //导入方法依赖的package包/类
/**
 * Updates the blocks bounds based on its current state. Args: world, x, y, z
 */
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
    TileEntityPiston tileentitypiston = this.getTileEntityAtLocation(par1IBlockAccess, par2, par3, par4);

    if (tileentitypiston != null)
    {
        Block block = Block.blocksList[tileentitypiston.getStoredBlockID()];

        if (block == null || block == this)
        {
            return;
        }

        block.setBlockBoundsBasedOnState(par1IBlockAccess, par2, par3, par4);
        float f = tileentitypiston.getProgress(0.0F);

        if (tileentitypiston.isExtending())
        {
            f = 1.0F - f;
        }

        int l = tileentitypiston.getPistonOrientation();
        this.minX = block.getBlockBoundsMinX() - (double)((float)Facing.offsetsXForSide[l] * f);
        this.minY = block.getBlockBoundsMinY() - (double)((float)Facing.offsetsYForSide[l] * f);
        this.minZ = block.getBlockBoundsMinZ() - (double)((float)Facing.offsetsZForSide[l] * f);
        this.maxX = block.getBlockBoundsMaxX() - (double)((float)Facing.offsetsXForSide[l] * f);
        this.maxY = block.getBlockBoundsMaxY() - (double)((float)Facing.offsetsYForSide[l] * f);
        this.maxZ = block.getBlockBoundsMaxZ() - (double)((float)Facing.offsetsZForSide[l] * f);
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:34,代码来源:BlockPistonMoving.java

示例4: renderTileEntityAt

import net.minecraft.tileentity.TileEntityPiston; //导入方法依赖的package包/类
public void renderTileEntityAt(TileEntityPiston p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_)
{
    Block block = p_147500_1_.getStoredBlockID();

    if (block.getMaterial() != Material.air && p_147500_1_.func_145860_a(p_147500_8_) < 1.0F)
    {
        Tessellator tessellator = Tessellator.instance;
        this.bindTexture(TextureMap.locationBlocksTexture);
        RenderHelper.disableStandardItemLighting();
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_CULL_FACE);

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GL11.glShadeModel(GL11.GL_SMOOTH);
        }
        else
        {
            GL11.glShadeModel(GL11.GL_FLAT);
        }

        tessellator.startDrawingQuads();
        tessellator.setTranslation((double)((float)p_147500_2_ - (float)p_147500_1_.xCoord + p_147500_1_.func_145865_b(p_147500_8_)), (double)((float)p_147500_4_ - (float)p_147500_1_.yCoord + p_147500_1_.func_145862_c(p_147500_8_)), (double)((float)p_147500_6_ - (float)p_147500_1_.zCoord + p_147500_1_.func_145859_d(p_147500_8_)));
        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);

        if (block == Blocks.piston_head && p_147500_1_.func_145860_a(p_147500_8_) < 0.5F)
        {
            this.field_147516_b.renderPistonExtensionAllFaces(block, p_147500_1_.xCoord, p_147500_1_.yCoord, p_147500_1_.zCoord, false);
        }
        else if (p_147500_1_.func_145867_d() && !p_147500_1_.isExtending())
        {
            Blocks.piston_head.func_150086_a(((BlockPistonBase)block).getPistonExtensionTexture());
            this.field_147516_b.renderPistonExtensionAllFaces(Blocks.piston_head, p_147500_1_.xCoord, p_147500_1_.yCoord, p_147500_1_.zCoord, p_147500_1_.func_145860_a(p_147500_8_) < 0.5F);
            Blocks.piston_head.func_150087_e();
            tessellator.setTranslation((double)((float)p_147500_2_ - (float)p_147500_1_.xCoord), (double)((float)p_147500_4_ - (float)p_147500_1_.yCoord), (double)((float)p_147500_6_ - (float)p_147500_1_.zCoord));
            this.field_147516_b.renderPistonBaseAllFaces(block, p_147500_1_.xCoord, p_147500_1_.yCoord, p_147500_1_.zCoord);
        }
        else
        {
            this.field_147516_b.renderBlockAllFaces(block, p_147500_1_.xCoord, p_147500_1_.yCoord, p_147500_1_.zCoord);
        }

        tessellator.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:49,代码来源:TileEntityRendererPiston.java

示例5: renderPiston

import net.minecraft.tileentity.TileEntityPiston; //导入方法依赖的package包/类
public void renderPiston(TileEntityPiston par1TileEntityPiston, double par2, double par4, double par6, float par8)
{
    Block block = Block.blocksList[par1TileEntityPiston.getStoredBlockID()];

    if (block != null && par1TileEntityPiston.getProgress(par8) < 1.0F)
    {
        Tessellator tessellator = Tessellator.instance;
        this.bindTexture(TextureMap.locationBlocksTexture);
        RenderHelper.disableStandardItemLighting();
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_CULL_FACE);

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GL11.glShadeModel(GL11.GL_SMOOTH);
        }
        else
        {
            GL11.glShadeModel(GL11.GL_FLAT);
        }

        tessellator.startDrawingQuads();
        tessellator.setTranslation((double)((float)par2 - (float)par1TileEntityPiston.xCoord + par1TileEntityPiston.getOffsetX(par8)), (double)((float)par4 - (float)par1TileEntityPiston.yCoord + par1TileEntityPiston.getOffsetY(par8)), (double)((float)par6 - (float)par1TileEntityPiston.zCoord + par1TileEntityPiston.getOffsetZ(par8)));
        tessellator.setColorOpaque(1, 1, 1);

        if (block == Block.pistonExtension && par1TileEntityPiston.getProgress(par8) < 0.5F)
        {
            this.blockRenderer.renderPistonExtensionAllFaces(block, par1TileEntityPiston.xCoord, par1TileEntityPiston.yCoord, par1TileEntityPiston.zCoord, false);
        }
        else if (par1TileEntityPiston.shouldRenderHead() && !par1TileEntityPiston.isExtending())
        {
            Block.pistonExtension.setHeadTexture(((BlockPistonBase)block).getPistonExtensionTexture());
            this.blockRenderer.renderPistonExtensionAllFaces(Block.pistonExtension, par1TileEntityPiston.xCoord, par1TileEntityPiston.yCoord, par1TileEntityPiston.zCoord, par1TileEntityPiston.getProgress(par8) < 0.5F);
            Block.pistonExtension.clearHeadTexture();
            tessellator.setTranslation((double)((float)par2 - (float)par1TileEntityPiston.xCoord), (double)((float)par4 - (float)par1TileEntityPiston.yCoord), (double)((float)par6 - (float)par1TileEntityPiston.zCoord));
            this.blockRenderer.renderPistonBaseAllFaces(block, par1TileEntityPiston.xCoord, par1TileEntityPiston.yCoord, par1TileEntityPiston.zCoord);
        }
        else
        {
            this.blockRenderer.renderBlockAllFaces(block, par1TileEntityPiston.xCoord, par1TileEntityPiston.yCoord, par1TileEntityPiston.zCoord);
        }

        tessellator.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:49,代码来源:TileEntityRendererPiston.java


注:本文中的net.minecraft.tileentity.TileEntityPiston.getStoredBlockID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。