mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-12 16:27:45 +00:00
All devs and contributors should use the provided formatter settings. If your IDE does not support the format, the rules are simple, it is the default java formatting rules, with 200char line lengths and 1 extra line after class definitions.
52 lines
1.3 KiB
Java
52 lines
1.3 KiB
Java
package com.cricketcraft.chisel.client.render;
|
|
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
import com.cricketcraft.chisel.utils.Drawing;
|
|
|
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
|
|
|
public class BlockNoCTMRenderer implements ISimpleBlockRenderingHandler {
|
|
|
|
static int id;
|
|
|
|
public BlockNoCTMRenderer() {
|
|
id = RenderingRegistry.getNextAvailableRenderId();
|
|
}
|
|
|
|
@Override
|
|
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
|
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
|
Drawing.drawBlock(block, meta, renderer);
|
|
}
|
|
|
|
@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)
|
|
renderer.overrideBlockTexture = block.getIcon(0, meta);
|
|
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
|
renderer.renderStandardBlock(block, x, y, z);
|
|
renderer.overrideBlockTexture = null;
|
|
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldRender3DInInventory(int renderId) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public int getRenderId() {
|
|
return id;
|
|
}
|
|
|
|
}
|