Add visible configuration to Metallurgic Infuser, made Chemical Crystalizer auto-eject and gave it inventory configuration

This commit is contained in:
Aidan C. Brady 2014-02-17 00:14:02 -05:00
parent 95698e45ea
commit 9915d18baa
8 changed files with 69 additions and 16 deletions

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.ListUtils; import mekanism.api.ListUtils;
import mekanism.api.gas.Gas; import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack; import mekanism.api.gas.GasStack;
@ -24,7 +23,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import org.apache.commons.lang3.text.WordUtils;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -52,6 +50,7 @@ public class GuiChemicalCrystalizer extends GuiMekanism
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystalizer.png"))); guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystalizer.png")));
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystalizer.png"), 160, 23)); guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystalizer.png"), 160, 23));
guiElements.add(new GuiConfigurationTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystalizer.png")));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() { guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override @Override
public List<String> getInfo() public List<String> getInfo()

View file

@ -7,6 +7,7 @@ import mekanism.api.EnumColor;
import mekanism.api.gas.Gas; import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.OreGas; import mekanism.api.gas.OreGas;
import mekanism.client.render.tileentity.RenderConfigurableMachine;
import mekanism.common.ISpecialBounds; import mekanism.common.ISpecialBounds;
import mekanism.common.ObfuscatedNames; import mekanism.common.ObfuscatedNames;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
@ -50,6 +51,8 @@ public class MekanismRenderer
private static float lightmapLastY; private static float lightmapLastY;
private static boolean optifineBreak = false; private static boolean optifineBreak = false;
public static RenderConfigurableMachine machineRenderer = new RenderConfigurableMachine();
public static void init() public static void init()
{ {
MinecraftForge.EVENT_BUS.register(new MekanismRenderer()); MinecraftForge.EVENT_BUS.register(new MekanismRenderer());

View file

@ -1,6 +1,7 @@
package mekanism.client.render.tileentity; package mekanism.client.render.tileentity;
import mekanism.client.model.ModelChemicalCrystalizer; import mekanism.client.model.ModelChemicalCrystalizer;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.tile.TileEntityChemicalCrystalizer; import mekanism.common.tile.TileEntityChemicalCrystalizer;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
@ -50,5 +51,7 @@ public class RenderChemicalCrystalizer extends TileEntitySpecialRenderer
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
model.renderWithRotation(0.0625F, tileEntity.spin); model.renderWithRotation(0.0625F, tileEntity.spin);
GL11.glPopMatrix(); GL11.glPopMatrix();
MekanismRenderer.machineRenderer.renderAModelAt(tileEntity, x, y, z, partialTick);
} }
} }

View file

@ -2,18 +2,17 @@ package mekanism.client.render.tileentity;
import java.util.HashMap; import java.util.HashMap;
import mekanism.api.EnumColor;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.client.render.MekanismRenderer; import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.MekanismRenderer.DisplayInteger; import mekanism.client.render.MekanismRenderer.DisplayInteger;
import mekanism.client.render.MekanismRenderer.Model3D; import mekanism.client.render.MekanismRenderer.Model3D;
import mekanism.common.IInvConfiguration; import mekanism.common.IInvConfiguration;
import mekanism.common.item.ItemConfigurator; import mekanism.common.item.ItemConfigurator;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -36,6 +35,11 @@ public class RenderConfigurableMachine extends TileEntitySpecialRenderer
private HashMap<ForgeDirection, HashMap<EnumColor, DisplayInteger>> cachedOverlays = new HashMap<ForgeDirection, HashMap<EnumColor, DisplayInteger>>(); private HashMap<ForgeDirection, HashMap<EnumColor, DisplayInteger>> cachedOverlays = new HashMap<ForgeDirection, HashMap<EnumColor, DisplayInteger>>();
public RenderConfigurableMachine()
{
tileEntityRenderer = TileEntityRenderer.instance;
}
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
{ {
@ -44,6 +48,8 @@ public class RenderConfigurableMachine extends TileEntitySpecialRenderer
public void renderAModelAt(IInvConfiguration configurable, double x, double y, double z, float partialTick) public void renderAModelAt(IInvConfiguration configurable, double x, double y, double z, float partialTick)
{ {
GL11.glPushMatrix();
TileEntity tileEntity = (TileEntity)configurable; TileEntity tileEntity = (TileEntity)configurable;
EntityPlayer player = mc.thePlayer; EntityPlayer player = mc.thePlayer;
World world = mc.thePlayer.worldObj; World world = mc.thePlayer.worldObj;
@ -75,6 +81,8 @@ public class RenderConfigurableMachine extends TileEntitySpecialRenderer
pop(); pop();
} }
} }
GL11.glPopMatrix();
} }
private void pop() private void pop()

View file

@ -1,6 +1,7 @@
package mekanism.client.render.tileentity; package mekanism.client.render.tileentity;
import mekanism.client.model.ModelMetallurgicInfuser; import mekanism.client.model.ModelMetallurgicInfuser;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.tile.TileEntityMetallurgicInfuser; import mekanism.common.tile.TileEntityMetallurgicInfuser;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
@ -41,5 +42,7 @@ public class RenderMetallurgicInfuser extends TileEntitySpecialRenderer
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
model.render(0.0625F); model.render(0.0625F);
GL11.glPopMatrix(); GL11.glPopMatrix();
MekanismRenderer.machineRenderer.renderAModelAt(tileEntity, x, y, z, partialTick);
} }
} }

View file

@ -3,6 +3,7 @@ package mekanism.common.tile;
import java.util.ArrayList; import java.util.ArrayList;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.gas.Gas; import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.GasStack; import mekanism.api.gas.GasStack;
@ -13,37 +14,40 @@ import mekanism.api.gas.IGasItem;
import mekanism.api.gas.ITubeConnection; import mekanism.api.gas.ITubeConnection;
import mekanism.client.sound.IHasSound; import mekanism.client.sound.IHasSound;
import mekanism.common.IActiveState; import mekanism.common.IActiveState;
import mekanism.common.IEjector;
import mekanism.common.IInvConfiguration;
import mekanism.common.IRedstoneControl; import mekanism.common.IRedstoneControl;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.PacketHandler; import mekanism.common.PacketHandler;
import mekanism.common.PacketHandler.Transmission; import mekanism.common.PacketHandler.Transmission;
import mekanism.common.SideData;
import mekanism.common.block.BlockMachine.MachineType; import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity; import mekanism.common.network.PacketTileEntity;
import mekanism.common.recipe.RecipeHandler; import mekanism.common.recipe.RecipeHandler;
import mekanism.common.tile.component.TileComponentEjector;
import mekanism.common.util.ChargeUtils; import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils; import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;
public class TileEntityChemicalCrystalizer extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound public class TileEntityChemicalCrystalizer extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, IInvConfiguration
{ {
public GasTank inputTank = new GasTank(MAX_GAS);
public static final int MAX_GAS = 10000; public static final int MAX_GAS = 10000;
public static final int MAX_FLUID = 10000; public static final int MAX_FLUID = 10000;
public byte[] sideConfig = new byte[] {0, 3, 0, 0, 1, 2};
public ArrayList<SideData> sideOutputs = new ArrayList<SideData>();
public GasTank inputTank = new GasTank(MAX_GAS);
public static int WATER_USAGE = 5; public static int WATER_USAGE = 5;
public int updateDelay; public int updateDelay;
@ -69,10 +73,19 @@ public class TileEntityChemicalCrystalizer extends TileEntityElectricBlock imple
/** This machine's current RedstoneControl type. */ /** This machine's current RedstoneControl type. */
public RedstoneControl controlType = RedstoneControl.DISABLED; public RedstoneControl controlType = RedstoneControl.DISABLED;
public TileComponentEjector ejectorComponent;
public TileEntityChemicalCrystalizer() public TileEntityChemicalCrystalizer()
{ {
super("ChemicalCrystalizer", MachineType.CHEMICAL_CRYSTALIZER.baseEnergy); super("ChemicalCrystalizer", MachineType.CHEMICAL_CRYSTALIZER.baseEnergy);
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
sideOutputs.add(new SideData(EnumColor.PURPLE, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, new int[] {2}));
inventory = new ItemStack[3]; inventory = new ItemStack[3];
ejectorComponent = new TileComponentEjector(this, sideOutputs.get(1));
} }
@Override @Override
@ -433,4 +446,28 @@ public class TileEntityChemicalCrystalizer extends TileEntityElectricBlock imple
{ {
return 1; return 1;
} }
@Override
public ArrayList<SideData> getSideData()
{
return sideOutputs;
}
@Override
public byte[] getConfiguration()
{
return sideConfig;
}
@Override
public int getOrientation()
{
return facing;
}
@Override
public IEjector getEjector()
{
return ejectorComponent;
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB