Hi, i'm trying to make a camouflage block with a TileEntitySpecialRenderer
This is the code (copied from http://www.minecraftforge.net/forum/index.php?topic=11397.msg59091#msg59091, just for an experiment) :
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) {
if (tileEntity instanceof MyTileEntity) {
Block block = Blocks.dirt; // i just trying dirt
if (block != null) {
RenderHelper.disableStandardItemLighting();
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
if (Minecraft.isAmbientOcclusionEnabled()) {
GL11.glShadeModel(GL11.GL_SMOOTH);
} else {
GL11.glShadeModel(GL11.GL_FLAT);
}
GL11.glPushMatrix();
GL11.glTranslated(d0, d1, d2);
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("minecraft", "textures/blocks/dirt.png")); // bind dirt
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
RenderBlocks renderBlocks = new RenderBlocks(tileEntity.getWorldObj());
tessellator.setTranslation(-te.xCoord, -te.yCoord, -te.zCoord);
renderBlocks.renderBlockByRenderType(block, te.xCoord, te.yCoord, te.zCoord);
tessellator.draw();
tessellator.setTranslation(0, 0, 0);
GL11.glPopMatrix();
RenderHelper.enableStandardItemLighting();
}
}
}
This is what happens: