Some class renaming, move TextureSubmap to API and improve its methods

This commit is contained in:
tterrag1098 committed 2015-04-23 17:31:25 -04:00
1 parent c2fa40d57e
commit d50f2c9da5
36 files changed
+373 -294

No files matched your search

@@ -0,0 +1,78 @@
package com.cricketcraft.chisel.client.render;
import com.cricketcraft.chisel.block.BlockMultiLayerBase;
import com.cricketcraft.chisel.utils.Drawing;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
public class RendererMultiLayer implements ISimpleBlockRenderingHandler {
float bot = -0.001f, top = 1.0f - bot;
public static int id;
public RendererMultiLayer() {
id = RenderingRegistry.getNextAvailableRenderId();
}
@Override
public void renderInventoryBlock(Block blck, int meta, int modelID, RenderBlocks renderer) {
if (blck == null || !(blck instanceof BlockMultiLayerBase))
return;
BlockMultiLayerBase block = (BlockMultiLayerBase) blck;
if (block.icon != null) {
renderer.overrideBlockTexture = block.icon;
renderer.renderBlockAsItem(Blocks.stone, meta, 1.0f);
renderer.overrideBlockTexture = null;
} else if (block.base != null) {
renderer.renderBlockAsItem(block.base, meta, 1.0f);
}
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
renderer.setRenderBounds(bot, bot, bot, top, top, top);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
Drawing.drawBlock(block, meta, renderer);
GL11.glDisable(3042);
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) {
if (blck == null || !(blck instanceof BlockMultiLayerBase))
return false;
BlockMultiLayerBase block = (BlockMultiLayerBase) blck;
if (block.currentPass == 0) {
if (block.icon != null) {
renderer.overrideBlockTexture = block.icon;
renderer.renderStandardBlock(block, x, y, z);
renderer.overrideBlockTexture = null;
return true;
} else if (block.base != null) {
renderer.renderBlockByRenderType(block.base, x, y, z);
return true;
}
} else {
renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
return renderer.renderStandardBlock(block, x, y, z);
}
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return id;
}
}