Skip to content

Instantly share code, notes, and snippets.

@EmmaEwert
Created July 5, 2014 01:08
Show Gist options
  • Save EmmaEwert/99805de133fe6849b473 to your computer and use it in GitHub Desktop.
Save EmmaEwert/99805de133fe6849b473 to your computer and use it in GitHub Desktop.
package net.elyon.chocolate;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class BlockRenderingHandler implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
Tessellator tessellator = Tessellator.instance;
tessellator.draw();
Minecraft.getMinecraft().getFramebuffer().bindFramebufferTexture();
tessellator.startDrawingQuads();
tessellator.setColorOpaque_F(1.0f, 1.0f, 1.0f);
tessellator.addVertexWithUV(x+0.0f, y+0.0f, z, 0.0f, 0.0f);
tessellator.addVertexWithUV(x+1.0f, y+0.0f, z, 1.0f, 0.0f);
tessellator.addVertexWithUV(x+1.0f, y+1.0f, z, 1.0f, 1.0f);
tessellator.addVertexWithUV(x+0.0f, y+1.0f, z, 0.0f, 1.0f);
return true;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return false;
}
@Override
public int getRenderId() {
return BlockChocolate.renderId;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment