Merge branch 'development' into v8

Conflicts:
	src/main/java/mekanism/client/ClientProxy.java
This commit is contained in:
Ben Spiers 2014-12-15 00:05:39 +00:00
commit 9a47f800f9
4 changed files with 103 additions and 6 deletions

View file

@ -60,6 +60,7 @@ import mekanism.client.render.RenderTickHandler;
import mekanism.client.render.block.BasicRenderingHandler; import mekanism.client.render.block.BasicRenderingHandler;
import mekanism.client.render.block.CTMRenderingHandler; import mekanism.client.render.block.CTMRenderingHandler;
import mekanism.client.render.block.MachineRenderingHandler; import mekanism.client.render.block.MachineRenderingHandler;
import mekanism.client.render.block.PlasticRenderingHandler;
import mekanism.client.render.entity.RenderBalloon; import mekanism.client.render.entity.RenderBalloon;
import mekanism.client.render.entity.RenderFlame; import mekanism.client.render.entity.RenderFlame;
import mekanism.client.render.entity.RenderObsidianTNTPrimed; import mekanism.client.render.entity.RenderObsidianTNTPrimed;
@ -183,6 +184,7 @@ public class ClientProxy extends CommonProxy
{ {
public static int MACHINE_RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); public static int MACHINE_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
public static int BASIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); public static int BASIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
public static int PLASTIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
public static int CTM_RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); public static int CTM_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
@Override @Override
@ -349,6 +351,7 @@ public class ClientProxy extends CommonProxy
//Register block handlers //Register block handlers
RenderingRegistry.registerBlockHandler(new MachineRenderingHandler()); RenderingRegistry.registerBlockHandler(new MachineRenderingHandler());
RenderingRegistry.registerBlockHandler(new BasicRenderingHandler()); RenderingRegistry.registerBlockHandler(new BasicRenderingHandler());
RenderingRegistry.registerBlockHandler(new PlasticRenderingHandler());
RenderingRegistry.registerBlockHandler(new CTMRenderingHandler()); RenderingRegistry.registerBlockHandler(new CTMRenderingHandler());
Mekanism.logger.info("Render registrations complete."); Mekanism.logger.info("Render registrations complete.");

View file

@ -55,18 +55,12 @@ public class RenderGlowPanel implements IIconSelfRegister
{ {
c.computeLighting(LightModel.standardLightModel); c.computeLighting(LightModel.standardLightModel);
} }
for(CCModel c : lightModels)
{
c.computeLighting(LightModel.standardLightModel);
}
} }
public void renderStatic(PartGlowPanel panel) public void renderStatic(PartGlowPanel panel)
{ {
CCRenderState.reset(); CCRenderState.reset();
CCRenderState.setBrightness(panel.world(), panel.x(), panel.y(), panel.z()); CCRenderState.setBrightness(panel.world(), panel.x(), panel.y(), panel.z());
CCRenderState.hasColour = true;
Colour colour = new ColourRGBA(panel.colour.getColor(0), panel.colour.getColor(1), panel.colour.getColor(2), 1); Colour colour = new ColourRGBA(panel.colour.getColor(0), panel.colour.getColor(1), panel.colour.getColor(2), 1);
int side = panel.side.ordinal(); int side = panel.side.ordinal();

View file

@ -0,0 +1,94 @@
package mekanism.client.render.block;
import mekanism.client.ClientProxy;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.Mekanism;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class PlasticRenderingHandler implements ISimpleBlockRenderingHandler
{
@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 renderer)
{
boolean flag = false;
if(block == Mekanism.BlockGlowHDPE)
{
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(240);
int meta = world.getBlockMetadata(x, y, z);
int l = block.getRenderColor(meta);
int r = l >> 16 & 0xFF;
int g = l >> 8 & 0xFF;
int b = l & 0xFF;
tessellator.setColorOpaque(r, g, b);
if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x, y - 1, z, 0)))
{
renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 0));
flag = true;
}
if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x, y + 1, z, 1)))
{
renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 1));
flag = true;
}
if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x, y, z - 1, 2)))
{
renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 2));
flag = true;
}
if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x, y, z + 1, 3)))
{
renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 3));
flag = true;
}
if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x - 1, y, z, 4)))
{
renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 4));
flag = true;
}
if((renderer.renderAllFaces) || (block.shouldSideBeRendered(renderer.blockAccess, x + 1, y, z, 5)))
{
renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIcon(block, renderer.blockAccess, x, y, z, 5));
flag = true;
}
return flag;
}
flag = renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBoundsFromBlock(block);
return flag;
}
@Override
public int getRenderId()
{
return ClientProxy.PLASTIC_RENDER_ID;
}
@Override
public boolean shouldRender3DInInventory(int modelId)
{
return true;
}
}

View file

@ -3,6 +3,7 @@ package mekanism.common.block;
import java.util.List; import java.util.List;
import mekanism.api.EnumColor; import mekanism.api.EnumColor;
import mekanism.client.ClientProxy;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks; import mekanism.common.MekanismBlocks;
@ -123,4 +124,9 @@ public class BlockPlastic extends Block
} }
return false; return false;
} }
public int getRenderType()
{
return ClientProxy.PLASTIC_RENDER_ID;
}
} }