Skip to content

Instantly share code, notes, and snippets.

@hanetzer
Created August 1, 2014 04:22
Show Gist options
  • Save hanetzer/6460f35946e780b89575 to your computer and use it in GitHub Desktop.
Save hanetzer/6460f35946e780b89575 to your computer and use it in GitHub Desktop.
ISBRH
public class RendererAntenna implements ISimpleBlockRenderingHandler {
protected ModelBase model = new ModelAntenna();
/*
Not too sure what to do here
*/
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
//if it renders fancy in inventory do that rendering here.
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) {
// render as normal block
renderer.renderStandardBlock(block, x, y, z);
} else if (meta == 1) {
// render as model
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
GL11.glRotatef(180, 0, 0, 1);
GL11.glTranslatef(0f, -1f, 0f);
GL11.glPushMatrix();
// this is an error obviously
bindTexture(Constants.TEXTURES_MODEL.ANTENNA.getResourceLocation());
model.render(null, 0F, 0F, 0f, 0f, 0f, 0.0625f);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
return true;
}
/*
Not too sure what to do here
*/
@Override
public boolean shouldRender3DInInventory() {
return false; //is it rendered with the model in inventory or as a standard block?
}
/*
Not too sure what to do here
*/
@Override
public int getRenderId() {
return Globals.RENDER_ANTENNA; //we'll set this to -1 and update it in client proxy
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment