RenderItemBlockGlassTank.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:Steam-and-Steel 作者:
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    RenderBlocks renderblocks = (RenderBlocks) data[0];
    Block block = Block.getBlockFromItem(item.getItem());
    if (item.hasTagCompound()) {
        NBTTagCompound tag = item.stackTagCompound;
        if (tag.hasKey("Fluid")) {
            FluidStack liquid = FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("Fluid"));
            if (liquid != null) {
                GL11.glEnable(GL11.GL_BLEND);
                float height = ((float) liquid.amount / (float) 8000 * (float) 0.99);
                renderblocks.setRenderBounds(0.01, 0.01, 0.01, 0.99, height, 0.99);
                Utils.renderInventoryBlock(renderblocks, GrandFluidTank.renderblocks, liquid.getFluid());
                GL11.glDisable(GL11.GL_BLEND);
            }
        }

        GL11.glEnable(GL11.GL_ALPHA_TEST);
        renderblocks.setRenderBounds(0, 0, 0, 1, 1, 1);
        Utils.renderInventoryBlock(renderblocks, block, GrandFluidTank.glassfluidtank.getIcon(0, 0));
        GL11.glDisable(GL11.GL_ALPHA_TEST);

    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号