Glow Panel item rendering
This commit is contained in:
parent
386fd4e770
commit
24d620facc
4 changed files with 42 additions and 0 deletions
|
@ -349,6 +349,7 @@ public class ClientProxy extends CommonProxy
|
|||
MinecraftForgeClient.registerItemRenderer(Mekanism.Balloon.itemID, handler);
|
||||
MinecraftForgeClient.registerItemRenderer(Mekanism.FreeRunners.itemID, handler);
|
||||
MinecraftForgeClient.registerItemRenderer(Mekanism.AtomicDisassembler.itemID, handler);
|
||||
MinecraftForgeClient.registerItemRenderer(Mekanism.GlowPanel.itemID, handler);
|
||||
|
||||
//Register block handlers
|
||||
RenderingRegistry.registerBlockHandler(new MachineRenderingHandler());
|
||||
|
|
|
@ -122,6 +122,24 @@ public class RenderGlowPanel implements IIconRegister
|
|||
lightModels[side].render(0, lightModels[side].verts.length, new Translation(panel.x(), panel.y(), panel.z()), new IconTransformation(icon), new ColourMultiplier(colour));
|
||||
}
|
||||
|
||||
public void renderItem(int metadata)
|
||||
{
|
||||
TextureUtils.bindAtlas(0);
|
||||
CCRenderState.reset();
|
||||
CCRenderState.startDrawing(7);
|
||||
CCRenderState.useModelColours(true);
|
||||
EnumColor c = EnumColor.DYES[metadata];
|
||||
|
||||
Colour colour = new ColourRGBA(c.getColor(0), c.getColor(1), c.getColor(2), 1);
|
||||
Colour white = new ColourRGBA(1.0, 1.0, 1.0, 1.0);
|
||||
for(int i=4;i<5;i++){
|
||||
|
||||
frameModels[i].render(0, frameModels[i].verts.length, new Translation(0, 0, 0), new IconTransformation(icon), new ColourMultiplier(white));
|
||||
lightModels[i].render(0, lightModels[i].verts.length, new Translation(0, 0, 0), new IconTransformation(icon), new ColourMultiplier(colour));
|
||||
}
|
||||
CCRenderState.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister register)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@ import mekanism.client.model.ModelObsidianTNT;
|
|||
import mekanism.client.model.ModelRobit;
|
||||
import mekanism.client.model.ModelScubaTank;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.RenderGlowPanel;
|
||||
import mekanism.client.render.RenderPartTransmitter;
|
||||
import mekanism.client.render.entity.RenderBalloon;
|
||||
import mekanism.client.render.tileentity.RenderBin;
|
||||
|
@ -35,6 +36,7 @@ import mekanism.common.item.ItemGasMask;
|
|||
import mekanism.common.item.ItemRobit;
|
||||
import mekanism.common.item.ItemScubaTank;
|
||||
import mekanism.common.item.ItemWalkieTalkie;
|
||||
import mekanism.common.multipart.ItemGlowPanel;
|
||||
import mekanism.common.multipart.ItemPartTransmitter;
|
||||
import mekanism.common.multipart.TransmitterType;
|
||||
import mekanism.common.tile.TileEntityBin;
|
||||
|
@ -46,6 +48,7 @@ import net.minecraft.client.gui.FontRenderer;
|
|||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
|
@ -415,6 +418,20 @@ public class ItemRenderingHandler implements IItemRenderer
|
|||
RenderPartTransmitter.getInstance().renderItem(TransmitterType.values()[item.getItemDamage()]);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
else if(item.getItem() instanceof ItemGlowPanel)
|
||||
{
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GL11.glTranslated(-0.5, -0.5, -0.5);
|
||||
double d = 0.15;
|
||||
GL11.glTranslated(d, d, d);
|
||||
GL11.glScaled(2, 2, 2);
|
||||
GL11.glTranslated(0.4-2*d, -2*d, -2*d);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
RenderGlowPanel.getInstance().renderItem(item.getItemDamage());
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
else {
|
||||
if(item.getItem() instanceof ItemBlockMachine)
|
||||
{
|
||||
|
|
|
@ -87,4 +87,10 @@ public class ItemGlowPanel extends JItemMultiPart
|
|||
|
||||
return colourName + " " + super.getItemDisplayName(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRotateAroundWhenRendering()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue