Bins now use the dynamic texture render system

This commit is contained in:
Aidan C. Brady 2015-03-26 20:03:46 -04:00
parent babc934079
commit 3ba0dd5172
5 changed files with 33 additions and 40 deletions

View file

@ -3,16 +3,16 @@ package mekanism.client.render.block;
import mekanism.client.ClientProxy;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.MekanismBlocks;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class BasicRenderingHandler implements ISimpleBlockRenderingHandler
{
@ -29,6 +29,7 @@ public class BasicRenderingHandler implements ISimpleBlockRenderingHandler
MekanismRenderer.blendOn();
}
GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
MekanismRenderer.renderItem(renderer, metadata, block);
if(block == MekanismBlocks.BasicBlock && metadata == 10)

View file

@ -6,7 +6,6 @@ import mekanism.client.render.MekanismRenderer;
import mekanism.common.CTMData;
import mekanism.common.base.IBlockCTM;
import mekanism.common.tile.TileEntityBasicBlock;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;

View file

@ -50,7 +50,6 @@ import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
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;
@ -190,7 +189,7 @@ public class ItemRenderingHandler implements IItemRenderer
amount = Integer.toString(inv.getItemCount());
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
MekanismRenderer.glowOn();
if(itemStack != null)
{
@ -230,6 +229,8 @@ public class ItemRenderingHandler implements IItemRenderer
GL11.glPopMatrix();
}
MekanismRenderer.glowOff();
if(amount != "")
{
float maxScale = 0.02F;

View file

@ -9,6 +9,8 @@ import mekanism.api.Coord4D;
import mekanism.api.Range4D;
import mekanism.api.energy.IEnergizedItem;
import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.MekanismRenderer.DefIcon;
import mekanism.client.render.MekanismRenderer.ICustomBlockIcon;
import mekanism.common.CTMData;
import mekanism.common.ItemAttacher;
@ -88,7 +90,7 @@ import cpw.mods.fml.relauncher.SideOnly;
*/
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];
@ -160,11 +162,10 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
icons[3][0] = register.registerIcon("mekanism:CoalBlock");
icons[4][0] = register.registerIcon("mekanism:RefinedGlowstone");
icons[5][0] = register.registerIcon("mekanism:SteelBlock");
icons[6][0] = register.registerIcon("mekanism:BinSide");
icons[6][1] = register.registerIcon("mekanism:BinTop");
icons[6][2] = register.registerIcon("mekanism:BinFront");
icons[6][3] = register.registerIcon("mekanism:BinTopOn");
icons[6][4] = register.registerIcon("mekanism:BinFrontOn");
MekanismRenderer.loadDynamicTextures(register, "Bin", icons[6], DefIcon.getActivePair(register.registerIcon("mekanism:BinSide"), 3, 4, 5),
new DefIcon(register.registerIcon("mekanism:BinTop"), 0), new DefIcon(register.registerIcon("mekanism:BinTopOn"), 6));
icons[7][0] = register.registerIcon("mekanism:TeleporterFrame");
icons[8][0] = register.registerIcon("mekanism:SteelCasing");
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][2] = ctms[4][2].mainTextureData.icon;
icons[4][3] = ctms[4][3].mainTextureData.icon;
break;
}
}
@ -221,17 +223,8 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
case 6:
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
if(side == 0 || side == 1)
{
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];
}
boolean active = MekanismUtils.isActive(world, x, y, z);
return icons[meta][MekanismUtils.getBaseOrientation(side, tileEntity.facing)+(active ? 6 : 0)];
case 14:
TileEntitySolarEvaporationController tileEntity1 = (TileEntitySolarEvaporationController)world.getTileEntity(x, y, z);
@ -275,17 +268,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
switch(meta)
{
case 6:
if(side == 0 || side == 1)
{
return icons[meta][1];
}
else if(side == 3)
{
return icons[meta][2];
}
else {
return icons[meta][0];
}
return icons[meta][side];
case 14:
if(side == 3)
{

View file

@ -191,12 +191,21 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
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),
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryTop"), 1), DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryBottom"), 0), DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactorySide"), 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, BaseTier.BASIC.getName() + type.getUnlocalizedName() + MachineType.BASIC_FACTORY.name, factoryIcons[0][type.ordinal()],
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryFront"), 2),
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryTop"), 1),
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactoryBottom"), 0),
DefIcon.getActivePair(register.registerIcon("mekanism:BasicFactorySide"), 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);