Replace the old connected glass renderer with one adapted from Chisel.

I've made modifications to the original system to allow multi-meta CTM, such as between Dynamic Tanks and Dynamic Valves. This also allows texturing with effectively 5 textures, as opposed to the 47 needed previously
This commit is contained in:
Ben Spiers committed 2014-09-01 04:03:35 +01:00
1 parent 1ba5665e07
commit 5ae5036e62
66 files changed
+1083 -166

No files matched your search

@@ -0,0 +1,67 @@
package mekanism.client.render.block;
import mekanism.api.MekanismConfig;
import mekanism.client.ClientProxy;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.CTMData;
import mekanism.common.base.IBlockCTM;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
/**
* CTM ISBRH adapted from Chisel
* Code licensed under GPLv2
* @author AUTOMATIC_MAIDEN, asie, pokefenn, unpairedbracket
*/
public class CTMRenderingHandler implements ISimpleBlockRenderingHandler
{
RenderBlocksCTM rendererCTM = new RenderBlocksCTM();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
MekanismRenderer.renderItem(renderer, metadata, block);
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks rendererOld)
{
int meta = world.getBlockMetadata(x, y, z);
CTMData blockCTM = ((IBlockCTM)block).getCTMData(meta);
if(MekanismConfig.client.renderCTM && blockCTM != null)
{
rendererCTM.blockAccess = world;
rendererCTM.renderMaxX = 1.0;
rendererCTM.renderMaxY = 1.0;
rendererCTM.renderMaxZ = 1.0;
rendererCTM.submap = blockCTM.submap;
rendererCTM.submapSmall = blockCTM.submapSmall;
rendererCTM.metas = blockCTM.acceptableMetas;
rendererCTM.rendererOld = rendererOld;
return rendererCTM.renderStandardBlock(block, x, y, z);
}
return rendererOld.renderStandardBlock(block, x, y, z);
}
@Override
public boolean shouldRender3DInInventory(int renderId)
{
return true;
}
@Override
public int getRenderId()
{
return ClientProxy.CTM_RENDER_ID;
}
}