Merge branch 'master' into development
This commit is contained in:
commit
7ebcba8528
4 changed files with 103 additions and 6 deletions
|
@ -51,6 +51,7 @@ import mekanism.client.render.RenderPartTransmitter;
|
|||
import mekanism.client.render.RenderTickHandler;
|
||||
import mekanism.client.render.block.BasicRenderingHandler;
|
||||
import mekanism.client.render.block.MachineRenderingHandler;
|
||||
import mekanism.client.render.block.PlasticRenderingHandler;
|
||||
import mekanism.client.render.entity.RenderBalloon;
|
||||
import mekanism.client.render.entity.RenderObsidianTNTPrimed;
|
||||
import mekanism.client.render.entity.RenderRobit;
|
||||
|
@ -159,6 +160,7 @@ public class ClientProxy extends CommonProxy
|
|||
{
|
||||
public static int MACHINE_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static int BASIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static int PLASTIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void loadConfiguration()
|
||||
|
@ -339,6 +341,7 @@ public class ClientProxy extends CommonProxy
|
|||
//Register block handlers
|
||||
RenderingRegistry.registerBlockHandler(new MachineRenderingHandler());
|
||||
RenderingRegistry.registerBlockHandler(new BasicRenderingHandler());
|
||||
RenderingRegistry.registerBlockHandler(new PlasticRenderingHandler());
|
||||
|
||||
Mekanism.logger.info("Render registrations complete.");
|
||||
}
|
||||
|
|
|
@ -55,18 +55,12 @@ public class RenderGlowPanel implements IIconSelfRegister
|
|||
{
|
||||
c.computeLighting(LightModel.standardLightModel);
|
||||
}
|
||||
|
||||
for(CCModel c : lightModels)
|
||||
{
|
||||
c.computeLighting(LightModel.standardLightModel);
|
||||
}
|
||||
}
|
||||
|
||||
public void renderStatic(PartGlowPanel panel)
|
||||
{
|
||||
CCRenderState.reset();
|
||||
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);
|
||||
int side = panel.side.ordinal();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package mekanism.common.block;
|
|||
import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.ClientProxy;
|
||||
import mekanism.common.Mekanism;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -122,4 +123,9 @@ public class BlockPlastic extends Block
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getRenderType()
|
||||
{
|
||||
return ClientProxy.PLASTIC_RENDER_ID;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue