Bins now use the dynamic texture render system
This commit is contained in:
parent
babc934079
commit
3ba0dd5172
5 changed files with 33 additions and 40 deletions
|
@ -3,16 +3,16 @@ package mekanism.client.render.block;
|
||||||
import mekanism.client.ClientProxy;
|
import mekanism.client.ClientProxy;
|
||||||
import mekanism.client.render.MekanismRenderer;
|
import mekanism.client.render.MekanismRenderer;
|
||||||
import mekanism.common.MekanismBlocks;
|
import mekanism.common.MekanismBlocks;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class BasicRenderingHandler implements ISimpleBlockRenderingHandler
|
public class BasicRenderingHandler implements ISimpleBlockRenderingHandler
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,7 @@ public class BasicRenderingHandler implements ISimpleBlockRenderingHandler
|
||||||
MekanismRenderer.blendOn();
|
MekanismRenderer.blendOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
|
||||||
MekanismRenderer.renderItem(renderer, metadata, block);
|
MekanismRenderer.renderItem(renderer, metadata, block);
|
||||||
|
|
||||||
if(block == MekanismBlocks.BasicBlock && metadata == 10)
|
if(block == MekanismBlocks.BasicBlock && metadata == 10)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import mekanism.client.render.MekanismRenderer;
|
||||||
import mekanism.common.CTMData;
|
import mekanism.common.CTMData;
|
||||||
import mekanism.common.base.IBlockCTM;
|
import mekanism.common.base.IBlockCTM;
|
||||||
import mekanism.common.tile.TileEntityBasicBlock;
|
import mekanism.common.tile.TileEntityBasicBlock;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
|
@ -50,7 +50,6 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.model.ModelChest;
|
import net.minecraft.client.model.ModelChest;
|
||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.entity.RenderItem;
|
import net.minecraft.client.renderer.entity.RenderItem;
|
||||||
|
@ -190,7 +189,7 @@ public class ItemRenderingHandler implements IItemRenderer
|
||||||
amount = Integer.toString(inv.getItemCount());
|
amount = Integer.toString(inv.getItemCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
MekanismRenderer.glowOn();
|
||||||
|
|
||||||
if(itemStack != null)
|
if(itemStack != null)
|
||||||
{
|
{
|
||||||
|
@ -229,6 +228,8 @@ public class ItemRenderingHandler implements IItemRenderer
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MekanismRenderer.glowOff();
|
||||||
|
|
||||||
if(amount != "")
|
if(amount != "")
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,8 @@ import mekanism.api.Coord4D;
|
||||||
import mekanism.api.Range4D;
|
import mekanism.api.Range4D;
|
||||||
import mekanism.api.energy.IEnergizedItem;
|
import mekanism.api.energy.IEnergizedItem;
|
||||||
import mekanism.api.energy.IStrictEnergyStorage;
|
import mekanism.api.energy.IStrictEnergyStorage;
|
||||||
|
import mekanism.client.render.MekanismRenderer;
|
||||||
|
import mekanism.client.render.MekanismRenderer.DefIcon;
|
||||||
import mekanism.client.render.MekanismRenderer.ICustomBlockIcon;
|
import mekanism.client.render.MekanismRenderer.ICustomBlockIcon;
|
||||||
import mekanism.common.CTMData;
|
import mekanism.common.CTMData;
|
||||||
import mekanism.common.ItemAttacher;
|
import mekanism.common.ItemAttacher;
|
||||||
|
@ -88,7 +90,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
*/
|
*/
|
||||||
public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||||
{
|
{
|
||||||
public IIcon[][] icons = new IIcon[16][6];
|
public IIcon[][] icons = new IIcon[16][16];
|
||||||
|
|
||||||
public CTMData[][] ctms = new CTMData[16][4];
|
public CTMData[][] ctms = new CTMData[16][4];
|
||||||
|
|
||||||
|
@ -160,11 +162,10 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||||
icons[3][0] = register.registerIcon("mekanism:CoalBlock");
|
icons[3][0] = register.registerIcon("mekanism:CoalBlock");
|
||||||
icons[4][0] = register.registerIcon("mekanism:RefinedGlowstone");
|
icons[4][0] = register.registerIcon("mekanism:RefinedGlowstone");
|
||||||
icons[5][0] = register.registerIcon("mekanism:SteelBlock");
|
icons[5][0] = register.registerIcon("mekanism:SteelBlock");
|
||||||
icons[6][0] = register.registerIcon("mekanism:BinSide");
|
|
||||||
icons[6][1] = register.registerIcon("mekanism:BinTop");
|
MekanismRenderer.loadDynamicTextures(register, "Bin", icons[6], DefIcon.getActivePair(register.registerIcon("mekanism:BinSide"), 3, 4, 5),
|
||||||
icons[6][2] = register.registerIcon("mekanism:BinFront");
|
new DefIcon(register.registerIcon("mekanism:BinTop"), 0), new DefIcon(register.registerIcon("mekanism:BinTopOn"), 6));
|
||||||
icons[6][3] = register.registerIcon("mekanism:BinTopOn");
|
|
||||||
icons[6][4] = register.registerIcon("mekanism:BinFrontOn");
|
|
||||||
icons[7][0] = register.registerIcon("mekanism:TeleporterFrame");
|
icons[7][0] = register.registerIcon("mekanism:TeleporterFrame");
|
||||||
icons[8][0] = register.registerIcon("mekanism:SteelCasing");
|
icons[8][0] = register.registerIcon("mekanism:SteelCasing");
|
||||||
icons[9][0] = ctms[9][0].mainTextureData.icon;
|
icons[9][0] = ctms[9][0].mainTextureData.icon;
|
||||||
|
@ -203,6 +204,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||||
icons[4][1] = ctms[4][1].mainTextureData.icon;
|
icons[4][1] = ctms[4][1].mainTextureData.icon;
|
||||||
icons[4][2] = ctms[4][2].mainTextureData.icon;
|
icons[4][2] = ctms[4][2].mainTextureData.icon;
|
||||||
icons[4][3] = ctms[4][3].mainTextureData.icon;
|
icons[4][3] = ctms[4][3].mainTextureData.icon;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,17 +223,8 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||||
case 6:
|
case 6:
|
||||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(side == 0 || side == 1)
|
boolean active = MekanismUtils.isActive(world, x, y, z);
|
||||||
{
|
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
|
||||||
return MekanismUtils.isActive(world, x, y, z) ? icons[meta][3] : icons[meta][1];
|
|
||||||
}
|
|
||||||
else if(side == tileEntity.facing)
|
|
||||||
{
|
|
||||||
return MekanismUtils.isActive(world, x, y, z) ? icons[meta][4] : icons[meta][2];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return icons[meta][0];
|
|
||||||
}
|
|
||||||
case 14:
|
case 14:
|
||||||
TileEntitySolarEvaporationController tileEntity1 = (TileEntitySolarEvaporationController)world.getTileEntity(x, y, z);
|
TileEntitySolarEvaporationController tileEntity1 = (TileEntitySolarEvaporationController)world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
|
@ -275,17 +268,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
|
||||||
switch(meta)
|
switch(meta)
|
||||||
{
|
{
|
||||||
case 6:
|
case 6:
|
||||||
if(side == 0 || side == 1)
|
return icons[meta][side];
|
||||||
{
|
|
||||||
return icons[meta][1];
|
|
||||||
}
|
|
||||||
else if(side == 3)
|
|
||||||
{
|
|
||||||
return icons[meta][2];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return icons[meta][0];
|
|
||||||
}
|
|
||||||
case 14:
|
case 14:
|
||||||
if(side == 3)
|
if(side == 3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -191,12 +191,21 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
||||||
|
|
||||||
for(RecipeType type : RecipeType.values())
|
for(RecipeType type : RecipeType.values())
|
||||||
{
|
{
|
||||||
MekanismRenderer.loadDynamicTextures(register, BaseTier.BASIC.getName() + type.getUnlocalizedName() + MachineType.BASIC_FACTORY.name, factoryIcons[0][type.ordinal()], DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryFront"), 2),
|
MekanismRenderer.loadDynamicTextures(register, BaseTier.BASIC.getName() + type.getUnlocalizedName() + MachineType.BASIC_FACTORY.name, factoryIcons[0][type.ordinal()],
|
||||||
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryTop"), 1), DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryBottom"), 0), DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactorySide"), 3, 4, 5));
|
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryFront"), 2),
|
||||||
MekanismRenderer.loadDynamicTextures(register, BaseTier.ADVANCED.getName() + type.getUnlocalizedName() + MachineType.ADVANCED_FACTORY.name, factoryIcons[1][type.ordinal()], DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactoryFront"), 2),
|
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryTop"), 1),
|
||||||
DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactoryTop"), 1), DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactoryBottom"), 0), DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactorySide"), 3, 4, 5));
|
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryBottom"), 0),
|
||||||
MekanismRenderer.loadDynamicTextures(register, BaseTier.ELITE.getName() + type.getUnlocalizedName() + MachineType.ELITE_FACTORY.name, factoryIcons[2][type.ordinal()], DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactoryFront"), 2),
|
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactorySide"), 3, 4, 5));
|
||||||
DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactoryTop"), 1), DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactoryBottom"), 0), DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactorySide"), 3, 4, 5));
|
MekanismRenderer.loadDynamicTextures(register, BaseTier.ADVANCED.getName() + type.getUnlocalizedName() + MachineType.ADVANCED_FACTORY.name, factoryIcons[1][type.ordinal()],
|
||||||
|
DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactoryFront"), 2),
|
||||||
|
DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactoryTop"), 1),
|
||||||
|
DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactoryBottom"), 0),
|
||||||
|
DefIcon.getActivePair(register.registerIcon("mekanism:AdvancedFactorySide"), 3, 4, 5));
|
||||||
|
MekanismRenderer.loadDynamicTextures(register, BaseTier.ELITE.getName() + type.getUnlocalizedName() + MachineType.ELITE_FACTORY.name, factoryIcons[2][type.ordinal()],
|
||||||
|
DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactoryFront"), 2),
|
||||||
|
DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactoryTop"), 1),
|
||||||
|
DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactoryBottom"), 0),
|
||||||
|
DefIcon.getActivePair(register.registerIcon("mekanism:EliteFactorySide"), 3, 4, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
MekanismRenderer.loadDynamicTextures(register, MachineType.PURIFICATION_CHAMBER.name, icons[9], def);
|
MekanismRenderer.loadDynamicTextures(register, MachineType.PURIFICATION_CHAMBER.name, icons[9], def);
|
||||||
|
|
Loading…
Reference in a new issue