summaryrefslogtreecommitdiff
path: root/src/main/java/ihl/processing
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/ihl/processing')
-rw-r--r--src/main/java/ihl/processing/chemistry/ApparatusProcessableInvSlot.java59
-rw-r--r--src/main/java/ihl/processing/chemistry/BasicElectricMotorContainer.java74
-rw-r--r--src/main/java/ihl/processing/chemistry/BatteryItem.java194
-rw-r--r--src/main/java/ihl/processing/chemistry/ChemicalReactorContainer.java37
-rw-r--r--src/main/java/ihl/processing/chemistry/ChemicalReactorGui.java79
-rw-r--r--src/main/java/ihl/processing/chemistry/ChemicalReactorTileEntity.java294
-rw-r--r--src/main/java/ihl/processing/chemistry/CryogenicDistillerContainer.java39
-rw-r--r--src/main/java/ihl/processing/chemistry/CryogenicDistillerGui.java71
-rw-r--r--src/main/java/ihl/processing/chemistry/CryogenicDistillerTileEntity.java229
-rw-r--r--src/main/java/ihl/processing/chemistry/DosingPumpContainer.java95
-rw-r--r--src/main/java/ihl/processing/chemistry/DosingPumpGui.java103
-rw-r--r--src/main/java/ihl/processing/chemistry/DosingPumpTileEntity.java226
-rw-r--r--src/main/java/ihl/processing/chemistry/ElectricEvaporatorBlock.java220
-rw-r--r--src/main/java/ihl/processing/chemistry/ElectricEvaporatorContainer.java113
-rw-r--r--src/main/java/ihl/processing/chemistry/ElectricEvaporatorGui.java85
-rw-r--r--src/main/java/ihl/processing/chemistry/ElectricEvaporatorTileEntity.java430
-rw-r--r--src/main/java/ihl/processing/chemistry/ElectrolysisBathContainer.java79
-rw-r--r--src/main/java/ihl/processing/chemistry/ElectrolysisBathGui.java100
-rw-r--r--src/main/java/ihl/processing/chemistry/ElectrolysisBathModel.java86
-rw-r--r--src/main/java/ihl/processing/chemistry/ElectrolysisBathTileEntity.java297
-rw-r--r--src/main/java/ihl/processing/chemistry/EvaporatorBlock.java221
-rw-r--r--src/main/java/ihl/processing/chemistry/EvaporatorContainer.java100
-rw-r--r--src/main/java/ihl/processing/chemistry/EvaporatorGui.java84
-rw-r--r--src/main/java/ihl/processing/chemistry/EvaporatorTileEntity.java290
-rw-r--r--src/main/java/ihl/processing/chemistry/ExtruderModel.java100
-rw-r--r--src/main/java/ihl/processing/chemistry/FluidizedBedReactorContainer.java44
-rw-r--r--src/main/java/ihl/processing/chemistry/FluidizedBedReactorGui.java59
-rw-r--r--src/main/java/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java318
-rw-r--r--src/main/java/ihl/processing/chemistry/FractionatorBottomModel.java48
-rw-r--r--src/main/java/ihl/processing/chemistry/FractionatorBottomTileEntity.java352
-rw-r--r--src/main/java/ihl/processing/chemistry/FractionatorCoverModel.java52
-rw-r--r--src/main/java/ihl/processing/chemistry/FractionatorCoverTileEntity.java104
-rw-r--r--src/main/java/ihl/processing/chemistry/FractionatorSectionModel.java47
-rw-r--r--src/main/java/ihl/processing/chemistry/FractionatorSectionTileEntity.java148
-rw-r--r--src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpContainer.java76
-rw-r--r--src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpGui.java60
-rw-r--r--src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpModel.java64
-rw-r--r--src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpTileEntity.java83
-rw-r--r--src/main/java/ihl/processing/chemistry/LabElectrolyzerContainer.java73
-rw-r--r--src/main/java/ihl/processing/chemistry/LabElectrolyzerGui.java74
-rw-r--r--src/main/java/ihl/processing/chemistry/LabElectrolyzerTileEntity.java272
-rw-r--r--src/main/java/ihl/processing/chemistry/LeadOvenContainer.java95
-rw-r--r--src/main/java/ihl/processing/chemistry/LeadOvenGui.java55
-rw-r--r--src/main/java/ihl/processing/chemistry/LeadOvenTileEntity.java286
-rw-r--r--src/main/java/ihl/processing/chemistry/LoomContainer.java66
-rw-r--r--src/main/java/ihl/processing/chemistry/LoomGui.java60
-rw-r--r--src/main/java/ihl/processing/chemistry/LoomModel.java66
-rw-r--r--src/main/java/ihl/processing/chemistry/LoomTileEntity.java172
-rw-r--r--src/main/java/ihl/processing/chemistry/PaperMachineContainer.java41
-rw-r--r--src/main/java/ihl/processing/chemistry/PaperMachineGui.java79
-rw-r--r--src/main/java/ihl/processing/chemistry/PaperMachineTileEntity.java261
-rw-r--r--src/main/java/ihl/processing/chemistry/RefluxCondenserModel.java70
-rw-r--r--src/main/java/ihl/processing/chemistry/RefluxCondenserTileEntity.java148
-rw-r--r--src/main/java/ihl/processing/chemistry/SolarEvaporatorContainer.java112
-rw-r--r--src/main/java/ihl/processing/chemistry/SolarEvaporatorGui.java78
-rw-r--r--src/main/java/ihl/processing/chemistry/SolarEvaporatorTileEntity.java108
-rw-r--r--src/main/java/ihl/processing/invslots/IHLInvSlotOutput.java166
-rw-r--r--src/main/java/ihl/processing/invslots/InvSlotConsumableLiquidIHL.java271
-rw-r--r--src/main/java/ihl/processing/invslots/InvSlotUpgradeIHL.java61
-rw-r--r--src/main/java/ihl/processing/invslots/SlotInvSlotIronWorkbench.java32
-rw-r--r--src/main/java/ihl/processing/invslots/SlotInvSlotOutputInProgress.java23
-rw-r--r--src/main/java/ihl/processing/metallurgy/AchesonFurnaceGui.java46
-rw-r--r--src/main/java/ihl/processing/metallurgy/AchesonFurnanceContainer.java16
-rw-r--r--src/main/java/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java101
-rw-r--r--src/main/java/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java272
-rw-r--r--src/main/java/ihl/processing/metallurgy/CoilerContainer.java65
-rw-r--r--src/main/java/ihl/processing/metallurgy/CoilerGui.java48
-rw-r--r--src/main/java/ihl/processing/metallurgy/CoilerModel.java103
-rw-r--r--src/main/java/ihl/processing/metallurgy/CoilerRender.java80
-rw-r--r--src/main/java/ihl/processing/metallurgy/CoilerTileEntity.java155
-rw-r--r--src/main/java/ihl/processing/metallurgy/Crucible.java366
-rw-r--r--src/main/java/ihl/processing/metallurgy/CrucibleContainer.java66
-rw-r--r--src/main/java/ihl/processing/metallurgy/CrucibleGui.java84
-rw-r--r--src/main/java/ihl/processing/metallurgy/CrucibleInventory.java126
-rw-r--r--src/main/java/ihl/processing/metallurgy/CrucibleSlot.java18
-rw-r--r--src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineContainer.java39
-rw-r--r--src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineGui.java48
-rw-r--r--src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineModel.java57
-rw-r--r--src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineRender.java61
-rw-r--r--src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java198
-rw-r--r--src/main/java/ihl/processing/metallurgy/ElectricEngineItem.java84
-rw-r--r--src/main/java/ihl/processing/metallurgy/ExtruderContainer.java75
-rw-r--r--src/main/java/ihl/processing/metallurgy/ExtruderGui.java49
-rw-r--r--src/main/java/ihl/processing/metallurgy/ExtruderModel.java100
-rw-r--r--src/main/java/ihl/processing/metallurgy/ExtruderTileEntity.java155
-rw-r--r--src/main/java/ihl/processing/metallurgy/GasWeldingStationContainer.java99
-rw-r--r--src/main/java/ihl/processing/metallurgy/GasWeldingStationGui.java78
-rw-r--r--src/main/java/ihl/processing/metallurgy/GasWeldingStationModel.java108
-rw-r--r--src/main/java/ihl/processing/metallurgy/GasWeldingStationTileEntity.java286
-rw-r--r--src/main/java/ihl/processing/metallurgy/IProductionLine.java12
-rw-r--r--src/main/java/ihl/processing/metallurgy/ImpregnatingMachineContainer.java105
-rw-r--r--src/main/java/ihl/processing/metallurgy/ImpregnatingMachineGui.java63
-rw-r--r--src/main/java/ihl/processing/metallurgy/ImpregnatingMachineRender.java55
-rw-r--r--src/main/java/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java343
-rw-r--r--src/main/java/ihl/processing/metallurgy/InjectionMoldBlock.java248
-rw-r--r--src/main/java/ihl/processing/metallurgy/InjectionMoldTileEntity.java201
-rw-r--r--src/main/java/ihl/processing/metallurgy/LatheContainer.java72
-rw-r--r--src/main/java/ihl/processing/metallurgy/LatheGui.java51
-rw-r--r--src/main/java/ihl/processing/metallurgy/LathePart1Model.java93
-rw-r--r--src/main/java/ihl/processing/metallurgy/LathePart1TileEntity.java99
-rw-r--r--src/main/java/ihl/processing/metallurgy/LathePart2Model.java87
-rw-r--r--src/main/java/ihl/processing/metallurgy/LathePart2TileEntity.java104
-rw-r--r--src/main/java/ihl/processing/metallurgy/MachineBaseContainer.java74
-rw-r--r--src/main/java/ihl/processing/metallurgy/MachineBaseTileEntity.java279
-rw-r--r--src/main/java/ihl/processing/metallurgy/MuffleFurnaceGui.java48
-rw-r--r--src/main/java/ihl/processing/metallurgy/MuffleFurnanceContainer.java16
-rw-r--r--src/main/java/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java119
-rw-r--r--src/main/java/ihl/processing/metallurgy/RollingMachineContainer.java75
-rw-r--r--src/main/java/ihl/processing/metallurgy/RollingMachineGui.java50
-rw-r--r--src/main/java/ihl/processing/metallurgy/RollingMachinePart1Model.java97
-rw-r--r--src/main/java/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java149
-rw-r--r--src/main/java/ihl/processing/metallurgy/RollingMachinePart2Model.java42
-rw-r--r--src/main/java/ihl/processing/metallurgy/RollingMachinePart2TileEntity.java104
-rw-r--r--src/main/java/ihl/processing/metallurgy/RollingMachineRender.java81
-rw-r--r--src/main/java/ihl/processing/metallurgy/VulcanizationExtrudingMoldModel.java54
-rw-r--r--src/main/java/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java256
-rw-r--r--src/main/java/ihl/processing/metallurgy/WireMillContainer.java113
-rw-r--r--src/main/java/ihl/processing/metallurgy/WireMillGui.java68
-rw-r--r--src/main/java/ihl/processing/metallurgy/WireMillTileEntity.java378
-rw-r--r--src/main/java/ihl/processing/metallurgy/WoodenRollingMachineContainer.java77
-rw-r--r--src/main/java/ihl/processing/metallurgy/WoodenRollingMachineGui.java60
-rw-r--r--src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart1Model.java122
-rw-r--r--src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java158
-rw-r--r--src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart2Model.java44
-rw-r--r--src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart2TileEntity.java104
-rw-r--r--src/main/java/ihl/processing/metallurgy/WoodenRollingMachineRender.java91
126 files changed, 15004 insertions, 0 deletions
diff --git a/src/main/java/ihl/processing/chemistry/ApparatusProcessableInvSlot.java b/src/main/java/ihl/processing/chemistry/ApparatusProcessableInvSlot.java
new file mode 100644
index 0000000..bfed5c9
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ApparatusProcessableInvSlot.java
@@ -0,0 +1,59 @@
+package ihl.processing.chemistry;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ic2.api.recipe.IRecipeInput;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class ApparatusProcessableInvSlot extends InvSlot {
+
+ public ApparatusProcessableInvSlot(TileEntityInventory base1, String name1, int oldStartIndex1, Access access1,
+ int count, int stackSizeLimit1) {
+ super(base1, name1, oldStartIndex1, Access.I, count);
+ this.setStackSizeLimit(stackSizeLimit1);
+ }
+
+ public List<ItemStack> getItemStackList() {
+ List<ItemStack> list = new ArrayList<ItemStack>();
+ for (int i = 0; i < this.size(); i++) {
+ if (get(i) != null) {
+ list.add(get(i));
+ }
+ }
+ return list;
+ }
+
+ public ItemStack getItemStack(Item item) {
+ for (int i = 0; i < this.size(); i++) {
+ if (get(i) != null && get(i).getItem() == item) {
+ return get(i);
+ }
+ }
+ return null;
+ }
+
+ public void replaceItemStack(ItemStack stack1) {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) != null && this.get(i).getItem() == stack1.getItem()) {
+ this.put(i, stack1);
+ }
+ }
+ }
+
+ public void consume(IRecipeInput iRecipeInput) {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) != null && iRecipeInput.matches(this.get(i))) {
+ this.get(i).stackSize -= iRecipeInput.getAmount();
+ if (this.get(i).stackSize <= 0) {
+ this.put(i, null);
+ return;
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/BasicElectricMotorContainer.java b/src/main/java/ihl/processing/chemistry/BasicElectricMotorContainer.java
new file mode 100644
index 0000000..a32e006
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/BasicElectricMotorContainer.java
@@ -0,0 +1,74 @@
+package ihl.processing.chemistry;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import ihl.processing.metallurgy.BasicElectricMotorTileEntity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class BasicElectricMotorContainer<T extends BasicElectricMotorTileEntity> extends ContainerBase<T> {
+
+ protected BasicElectricMotorTileEntity tileEntity;
+ public short lastProgress = -1;
+ public short lastEnergy = -1;
+ private final static int height = 166;
+
+ public BasicElectricMotorContainer(EntityPlayer entityPlayer, T tileEntity1) {
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ int col;
+ for (col = 0; col < 3; ++col) {
+ for (int col1 = 0; col1 < 9; ++col1) {
+ this.addSlotToContainer(
+ new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+ for (col = 0; col < 9; ++col) {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 8, 33));
+ for (col = 0; col < 4; ++col) {
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.upgradeSlot, col, 152, 8 + col * 18));
+ }
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+
+ if (this.tileEntity.progress != this.lastProgress) {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+
+ if ((short) this.tileEntity.energy != this.lastEnergy) {
+ icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
+ }
+ }
+
+ this.lastProgress = this.tileEntity.progress;
+ this.lastEnergy = (short) this.tileEntity.energy;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value) {
+ super.updateProgressBar(index, value);
+ switch (index) {
+ case 0:
+ this.tileEntity.progress = (short) value;
+ break;
+ case 1:
+ break;
+ case 2:
+ this.tileEntity.energy = value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/BatteryItem.java b/src/main/java/ihl/processing/chemistry/BatteryItem.java
new file mode 100644
index 0000000..b9c5435
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/BatteryItem.java
@@ -0,0 +1,194 @@
+package ihl.processing.chemistry;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import ic2.api.item.IItemHudInfo;
+import ihl.IHLCreativeTab;
+import ihl.IHLModInfo;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class BatteryItem extends Item implements IElectricItem, IItemHudInfo
+{
+ public int maxCharge=65536;
+ public int transferLimit = 4096;
+ public int tier = 4;
+ private static Map<Integer, IIcon> iconMap = new HashMap<Integer, IIcon>();
+ private static Map<Integer, String> nameMap = new HashMap<Integer, String>();
+ private static Map<Integer, String> descriptionMap = new HashMap<Integer, String>();
+
+ public BatteryItem()
+ {
+ super();
+ this.setMaxDamage(27);
+ this.setCreativeTab(IHLCreativeTab.tab);
+ this.maxStackSize=1;
+ this.canRepair=false;
+ this.setUnlocalizedName("battery");
+ }
+
+ public static void init()
+ {
+ BatteryItem item = new BatteryItem();
+ GameRegistry.registerItem(item,item.getUnlocalizedName());
+ Type[] var1 = Type.values();
+ for(int i=0;i<var1.length;i++)
+ {
+ nameMap.put(var1[i].damage,var1[i].unLocalizedName);
+ IHLUtils.registerLocally(var1[i].unLocalizedName, new ItemStack(item,1,var1[i].damage));
+ if(var1[i].description!=null)
+ {
+ descriptionMap.put(var1[i].damage,var1[i].description);
+ }
+ }
+ }
+
+ @Override
+ public boolean canProvideEnergy(ItemStack itemStack)
+ {
+ return true;
+ }
+
+ @Override
+ public Item getChargedItem(ItemStack itemStack)
+ {
+ return this;
+ }
+
+ @Override
+ public Item getEmptyItem(ItemStack itemStack)
+ {
+ return this;
+ }
+
+ @Override
+ public double getMaxCharge(ItemStack itemStack)
+ {
+ return this.maxCharge;
+ }
+
+ @Override
+ public int getTier(ItemStack itemStack)
+ {
+ return this.tier;
+ }
+
+ @Override
+ public double getTransferLimit(ItemStack itemStack)
+ {
+ return this.transferLimit;
+ }
+
+ @Override
+ public List<String> getHudInfo(ItemStack itemStack)
+ {
+ LinkedList<String> info = new LinkedList<String>();
+ info.add(ElectricItem.manager.getToolTip(itemStack));
+ return info;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ Type[] var1 = Type.values();
+ for(int i=0;i<var1.length;i++)
+ {
+ iconMap.put(var1[i].damage, register.registerIcon(IHLModInfo.MODID + ":"+var1[i].textureName));
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int i)
+ {
+ return iconMap.get(0);
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack)
+ {
+ return nameMap.get(0);//stack.getItemDamage());
+ }
+
+ @SideOnly(Side.CLIENT)
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public void func_150895_a(Item item, CreativeTabs par2CreativeTabs, List itemList)
+ {
+ ItemStack itemStack = new ItemStack(this, 1);
+ ItemStack charged;
+
+ if (this.getChargedItem(itemStack) == this)
+ {
+ charged = new ItemStack(this, 1);
+ ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false);
+ itemList.add(charged);
+ }
+
+ if (this.getEmptyItem(itemStack) == this)
+ {
+ charged = new ItemStack(this, 1);
+ ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false);
+ itemList.add(charged);
+ }
+ }
+
+ public static ItemStack getFullyChargedItemStack(String name)
+ {
+ ItemStack stack = IHLUtils.getThisModItemStack(name);
+ ElectricItem.manager.charge(stack, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false);
+ return stack;
+ }
+
+ @Override
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean flag)
+ {
+ if(BatteryItem.descriptionMap.containsKey(0))//itemStack.getItemDamage()))
+ {
+ info.add(BatteryItem.descriptionMap.get(0));//itemStack.getItemDamage()));
+ }
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack)
+ {
+ return (this.maxCharge-ElectricItem.manager.getCharge(stack))/this.maxCharge;
+ }
+
+ public enum Type
+ {
+ LeadAcidBattery(0,"leadAcidBattery","Pb/Pb2PbO4 + H2SO4");
+ Type(int damage1,String unlocalizedName1,String description1)
+ {
+ damage=damage1;
+ textureName=oreRegistryName=unLocalizedName=unlocalizedName1;
+ description=description1;
+ }
+ public int damage;
+ public String unLocalizedName;
+ public String oreRegistryName;
+ public String description;
+ public String textureName;
+ }
+
+ public static ItemStack getFullyChargedItemStackWithSize(String name, int stackSize1)
+ {
+ ItemStack stack = getFullyChargedItemStack(name);
+ stack.stackSize=stackSize1;
+ return stack;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/ChemicalReactorContainer.java b/src/main/java/ihl/processing/chemistry/ChemicalReactorContainer.java
new file mode 100644
index 0000000..16b6baa
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ChemicalReactorContainer.java
@@ -0,0 +1,37 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraftforge.fluids.FluidStack;
+
+public class ChemicalReactorContainer extends BasicElectricMotorContainer<ChemicalReactorTileEntity> {
+
+ protected ChemicalReactorTileEntity tileEntity;
+ public List<FluidStack> fluidTankFluidList;
+ public int fluidListHash = -1;
+
+ public ChemicalReactorContainer(EntityPlayer entityPlayer, ChemicalReactorTileEntity tileEntity1) {
+ super(entityPlayer, tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList = tileEntity.getFluidTank().getFluidList();
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 60, 51));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 60, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 60, 33));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 122 - 18, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 122, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 122 - 18, 51));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 122, 51));
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (this.fluidListHash != fluidTankFluidList.hashCode()) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ this.fluidListHash = fluidTankFluidList.hashCode();
+ }
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/ChemicalReactorGui.java b/src/main/java/ihl/processing/chemistry/ChemicalReactorGui.java
new file mode 100644
index 0000000..de22f76
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ChemicalReactorGui.java
@@ -0,0 +1,79 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+@SideOnly(Side.CLIENT)
+public class ChemicalReactorGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIChemicalReactor.png");
+ private ChemicalReactorContainer container;
+ private int mixerFrame=0;
+
+ public ChemicalReactorGui (ChemicalReactorContainer container1) {
+ //the container is instanciated and passed to the superclass for handling
+ super(container1);
+ this.container=container1;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(12, 16 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27),27);
+ this.drawTexturedModalRect(30, 29, getFrameX(i1), getFrameY(i1),24,24);
+ if(mixerFrame++>4)
+ {
+ mixerFrame=0;
+ }
+ }
+ else
+ {
+ mixerFrame=0;
+ }
+ this.drawTexturedModalRect(103-18, 52, 246, 226+6*mixerFrame,10,6);
+ if (this.container.tileEntity.getTankAmount() > 0)
+ {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 102-18, 28, 114-18, 59, zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ private int getFrameY(int number)
+ {
+ return (number % 10) * 24 + 14;
+ }
+
+ private int getFrameX(int number)
+ {
+ return (number / 10) * 24 + 176;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/ChemicalReactorTileEntity.java b/src/main/java/ihl/processing/chemistry/ChemicalReactorTileEntity.java
new file mode 100644
index 0000000..7de2ccf
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ChemicalReactorTileEntity.java
@@ -0,0 +1,294 @@
+package ihl.processing.chemistry;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlot.Access;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.processing.metallurgy.BasicElectricMotorTileEntity;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class ChemicalReactorTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler
+{
+ private final static UniversalRecipeManager recipeManager = new UniversalRecipeManager("chemicalreactor");
+ public final ApparatusProcessableInvSlot input;
+ public final IHLInvSlotOutput outputSlot;
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ private final IHLFluidTank fluidTank = new IHLFluidTank(8000);
+ public short temperature=20;
+
+ public ChemicalReactorTileEntity() {
+ super();
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 2);
+ this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 1);
+ this.input = new ApparatusProcessableInvSlot(this, "input", 3, Access.I, 2, 64);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=side;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("chemicalReactor");
+ }
+
+ @Override
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, fluidTank);
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, int amount, boolean doDrain)
+ {
+ switch(from)
+ {
+ case UP:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case NORTH:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case SOUTH:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case WEST:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case EAST:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case DOWN:
+ return this.fluidTank.drain(amount, doDrain);
+ default:
+ return this.fluidTank.drain(amount, doDrain);
+ }
+ }
+
+ //1.7.10 API
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "chemicalReactor";
+ }
+
+ public float getRenderLiquidLevel()
+ {
+ return (float)this.fluidTank.getFluidAmount()/(float)this.fluidTank.getCapacity();
+ }
+
+ @Override
+ public int gaugeProgressScaled(int i)
+ {
+ return this.progress * i / operationLength;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new ChemicalReactorGui(new ChemicalReactorContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player)
+ {
+ this.fluidTank.sortFluidsByDensity();
+ return new ChemicalReactorContainer(player, this);
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer player) {}
+
+ @Override
+ public boolean canOperate()
+ {
+ UniversalRecipeOutput output = getOutput();
+ if(output!=null && this.outputSlot.canAdd(getOutput().getItemOutputs()))
+ {
+ if(output.specialConditions)
+ {
+ return this.checkSpecialConditions();
+ }
+ else
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean checkSpecialConditions()
+ {
+ ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing());
+ TileEntity te = worldObj.getTileEntity(xCoord+dir.offsetX, yCoord, zCoord+dir.offsetZ);
+ if(te instanceof CryogenicDistillerTileEntity)
+ {
+ CryogenicDistillerTileEntity cgte = (CryogenicDistillerTileEntity)te;
+ return cgte.getFacing()==this.getFacing() && cgte.canProcess();
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public UniversalRecipeOutput getOutput()
+ {
+ return ChemicalReactorTileEntity.recipeManager.getOutputFor(this.getInput()[0],this.getInput()[1]);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public List[] getInput()
+ {
+ return new List[] {fluidTank.getFluidList(), this.input.getItemStackList()};
+ }
+
+ @Override
+ @SuppressWarnings({ "unchecked"})
+ public void operate()
+ {
+ UniversalRecipeInput recipeInput = ChemicalReactorTileEntity.recipeManager.getRecipeInput(this.getInput()[0],this.getInput()[1]);
+ UniversalRecipeOutput output1 = getOutput();
+ for(int i=0; i<recipeInput.getItemInputs().size();i++)
+ {
+ this.input.consume(recipeInput.getItemInputs().get(i));
+ }
+ if(output1.specialConditions)
+ {
+ ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing());
+ TileEntity te = worldObj.getTileEntity(xCoord+dir.offsetX, yCoord, zCoord+dir.offsetZ);
+ if(te instanceof CryogenicDistillerTileEntity)
+ {
+ CryogenicDistillerTileEntity cgte = (CryogenicDistillerTileEntity)te;
+ cgte.fill(ForgeDirection.getOrientation(this.getFacing()).getOpposite(), recipeInput.getFluidInputs().get(0).getInputs().get(0), true);
+ }
+ }
+ this.fluidTank.drain(recipeInput.getFluidInputs(), true);
+ this.fluidTank.fill(output1.getFluidOutputs(), true);
+ this.outputSlot.add(output1.getItemOutputs());
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) {
+ if(fluidTank.getFluid()!=null && fluidTank.getFluid().containsFluid(fluidStack))
+ {
+ return this.fluidTank.drain(fluidStack, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.fluidTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[] {this.fluidTank.getInfo()};
+ }
+
+ public boolean needsFluid()
+ {
+ return this.fluidTank.getFluidAmount() <= this.fluidTank.getCapacity();
+ }
+
+ public FluidStack getFluidStackfromTank()
+ {
+ return this.fluidTank.getFluid();
+ }
+
+ public int getTankAmount()
+ {
+ return this.fluidTank.getFluidAmount();
+ }
+
+ public int gaugeLiquidScaled(int i, int index)
+ {
+ return this.fluidTank.getFluidAmount() <= 0 ? 0 : this.fluidTank.getFluidAmount(index) * i / this.fluidTank.getCapacity();
+ }
+ public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output)
+ {
+ recipeManager.addRecipe(input, output);
+ }
+
+ public int getNumberOfFluidsInTank()
+ {
+ return this.fluidTank.getNumberOfFluids();
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ public static void addRecipe(FluidStack fluidStackInput1, FluidStack fluidStackInput2, ItemStack itemStackInput, FluidStack fluidStackOutput, ItemStack itemStackOutput1, ItemStack itemStackOutput2)
+ {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] {fluidStackInput1, fluidStackInput2}), (new ItemStack[] {itemStackInput})), new UniversalRecipeOutput((new FluidStack[] {fluidStackOutput}), (new ItemStack[] {itemStackOutput1, itemStackOutput2}),200));
+ }
+
+ public static void addSpecialConditionsRecipe(FluidStack fluidStackInput1, FluidStack fluidStackInput2, ItemStack itemStackInput, FluidStack fluidStackOutput, ItemStack itemStackOutput1, ItemStack itemStackOutput2)
+ {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] {fluidStackInput1, fluidStackInput2}), (new ItemStack[] {itemStackInput})), new UniversalRecipeOutput((new FluidStack[] {fluidStackOutput}), (new ItemStack[] {itemStackOutput1, itemStackOutput2}),200, true));
+ }
+
+ public IHLFluidTank getFluidTank()
+ {
+ return this.fluidTank;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/CryogenicDistillerContainer.java b/src/main/java/ihl/processing/chemistry/CryogenicDistillerContainer.java
new file mode 100644
index 0000000..988b844
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/CryogenicDistillerContainer.java
@@ -0,0 +1,39 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraftforge.fluids.FluidStack;
+
+public class CryogenicDistillerContainer extends BasicElectricMotorContainer<CryogenicDistillerTileEntity> {
+
+ public CryogenicDistillerTileEntity tileEntity;
+ private int lastNumberOfFluids = -1;
+ private int lastFluidAmount = -1;
+ public List<FluidStack> fluidTankFluidList;
+
+ public CryogenicDistillerContainer(EntityPlayer entityPlayer,
+ CryogenicDistillerTileEntity lathePart1TileEntity) {
+ super(entityPlayer, lathePart1TileEntity);
+ tileEntity=lathePart1TileEntity;
+ fluidTankFluidList=tileEntity.fluidTankProducts.getFluidList();
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.fillInputSlotInput,0, 58, 51));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.fillInputSlotProducts,0, 103, 51));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.fluidItemsSlot,0, 58, 15));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.fluidItemsSlot,1, 103, 15));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ if (this.tileEntity.fluidTankProducts.getFluidAmount() != this.lastFluidAmount || this.tileEntity.fluidTankProducts.getNumberOfFluids() != this.lastNumberOfFluids)
+ {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
+ this.lastNumberOfFluids = this.tileEntity.fluidTankProducts.getNumberOfFluids();
+ this.lastFluidAmount = this.tileEntity.fluidTankProducts.getFluidAmount();
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/CryogenicDistillerGui.java b/src/main/java/ihl/processing/chemistry/CryogenicDistillerGui.java
new file mode 100644
index 0000000..a8f9f0f
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/CryogenicDistillerGui.java
@@ -0,0 +1,71 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import ic2.core.IC2;
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+public class CryogenicDistillerGui extends GuiContainer {
+
+ private CryogenicDistillerContainer container;
+ protected static final ResourceLocation tex = new ResourceLocation("ihl", "textures/gui/GUICryogenicDistiller.png");
+
+ public CryogenicDistillerGui(CryogenicDistillerContainer latheContainer) {
+ super(latheContainer);
+ container = latheContainer;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void initGui() {
+ super.initGui();
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.buttonList.add(new GuiButton(0, x + 7, y + 50, 49, 20, "Empty"));
+ }
+
+ @Override
+ public void actionPerformed(GuiButton button) {
+ super.actionPerformed(button);
+ IC2.network.get().initiateClientTileEntityEvent(this.container.tileEntity, button.id);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12), 12);
+ this.drawTexturedModalRect(9, 15 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0) {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(18), 18);
+ this.drawTexturedModalRect(81, 35, 198, 0, i1 + 1, 13);
+ }
+ if (this.container.tileEntity.fluidTankProducts.getFluid() != null
+ && this.container.tileEntity.fluidTankProducts.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankProducts, 125, 28, 137, 67,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ // draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/CryogenicDistillerTileEntity.java b/src/main/java/ihl/processing/chemistry/CryogenicDistillerTileEntity.java
new file mode 100644
index 0000000..6a156db
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/CryogenicDistillerTileEntity.java
@@ -0,0 +1,229 @@
+package ihl.processing.chemistry;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.processing.metallurgy.BasicElectricMotorTileEntity;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.block.Block;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class CryogenicDistillerTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler {
+
+ public final InvSlotConsumableLiquidIHL fillInputSlotInput;
+ public final InvSlotOutput fluidItemsSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlotProducts;
+
+ private IHLFluidTank fluidTankInput = new IHLFluidTank(8000);
+ public IHLFluidTank fluidTankProducts = new IHLFluidTank(8000);
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("cryogenicdistiller");
+ protected static UniversalRecipeOutput airOutput = new UniversalRecipeOutput(new FluidStack[] {
+ IHLUtils.getFluidStackWithSize("nitrogen", 781), IHLUtils.getFluidStackWithSize("oxygen", 209) }, null, 20,
+ false);
+
+ static {
+ recipeManager.addRecipe(
+ new UniversalRecipeInput(new FluidStack[] { IHLUtils.getFluidStackWithSize("air", 1000) }, null),
+ airOutput);
+ }
+
+ public CryogenicDistillerTileEntity() {
+ super();
+ this.fillInputSlotInput = new InvSlotConsumableLiquidIHL(this, "fillInputSlotInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.fillInputSlotProducts = new InvSlotConsumableLiquidIHL(this, "fillInputSlotProducts", -1, InvSlot.Access.I,
+ 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.fluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 2);
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "CryogenicDistiller";
+ }
+
+ @Override
+ public void updateEntityServer() {
+ super.updateEntityServer();
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlotProducts, null, fluidItemsSlot, fluidTankProducts);
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer player) {
+ return IHLUtils.getThisModItemStack("cryogenicDistiller");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new CryogenicDistillerGui(new CryogenicDistillerContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new CryogenicDistillerContainer(player, this);
+ }
+
+ @Override
+ public void operate() {
+ UniversalRecipeInput ri = CryogenicDistillerTileEntity.recipeManager.getRecipeInput(getInput());
+ this.fluidTankProducts.fill(getOutput().getFluidOutputs(), true);
+ this.fluidTankInput.drain(ri.getFluidInputs().get(0), true);
+ TileEntity teOnTop = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
+ if (teOnTop instanceof IFluidHandler && this.fluidTankProducts.getLigthestFluid() != null) {
+ IFluidHandler topFH = (IFluidHandler) teOnTop;
+ if (topFH.canFill(ForgeDirection.DOWN, this.fluidTankProducts.getLigthestFluid().getFluid())) {
+ FluidStack fsToDrain = this.fluidTankProducts.getLigthestFluid().copy();
+ fsToDrain.amount = topFH.fill(ForgeDirection.DOWN, fsToDrain, true);
+ this.fluidTankProducts.drain(fsToDrain, true);
+ }
+ }
+ ForgeDirection orientation = ForgeDirection.getOrientation(this.getFacing());
+ TileEntity teOnFront = worldObj.getTileEntity(xCoord + orientation.offsetX, yCoord,
+ zCoord + orientation.offsetZ);
+ if (teOnFront instanceof IFluidHandler && this.fluidTankProducts.getFluid() != null) {
+ IFluidHandler frontFH = (IFluidHandler) teOnFront;
+ if (frontFH.canFill(orientation, this.fluidTankProducts.getFluid().getFluid())) {
+ FluidStack fsToDrain = this.fluidTankProducts.getFluid().copy();
+ fsToDrain.amount = frontFH.fill(orientation, fsToDrain, true);
+ this.fluidTankProducts.drain(fsToDrain, true);
+ }
+ }
+ }
+
+ public UniversalRecipeOutput getOutput() {
+ return CryogenicDistillerTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ @Override
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public List[] getInput() {
+ return new List[] { Arrays.asList(new FluidStack[] { this.fluidTankInput.getLigthestFluid() }), null };
+ }
+
+ @Override
+ public boolean canOperate() {
+ UniversalRecipeOutput output = this.getOutput();
+ if (output == airOutput) {
+ ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing()).getOpposite();
+ Block block = worldObj.getBlock(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
+ if (!block.isAir(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)
+ && block != Blocks.air)
+ return false;
+ }
+ return output != null && (this.fluidTankProducts.getCapacity() - this.fluidTankProducts.getFluidAmount()) > 0;
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer arg0) {
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTankInput.readFromNBT(nbttagcompound.getCompoundTag("fluidTankInput"));
+ this.fluidTankProducts.readFromNBT(nbttagcompound.getCompoundTag("fluidTankProducts"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankInputTag = new NBTTagCompound();
+ this.fluidTankInput.writeToNBT(fluidTankInputTag);
+ nbttagcompound.setTag("fluidTankInput", fluidTankInputTag);
+ NBTTagCompound fluidTankProductsTag = new NBTTagCompound();
+ this.fluidTankProducts.writeToNBT(fluidTankProductsTag);
+ nbttagcompound.setTag("fluidTankProducts", fluidTankProductsTag);
+ }
+
+ public static void addRecipe(FluidStack input, FluidStack output, FluidStack output2, boolean specialCondition) {
+ if (output2 != null) {
+ recipeManager.addRecipe(new UniversalRecipeInput(new FluidStack[] { input }, null),
+ new UniversalRecipeOutput(new FluidStack[] { output, output2 }, null, 20, specialCondition));
+ } else {
+ recipeManager.addRecipe(new UniversalRecipeInput(new FluidStack[] { input }, null),
+ new UniversalRecipeOutput(new FluidStack[] { output }, null, 20, specialCondition));
+ }
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ public boolean canProcess() {
+ return this.energy >= this.energyConsume;
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection dir, Fluid arg1) {
+ return dir.equals(ForgeDirection.getOrientation(this.getFacing())) || dir.equals(ForgeDirection.UP);
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection dir, Fluid fluid) {
+ return dir.equals(ForgeDirection.getOrientation(this.getFacing()).getOpposite());
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection dir, FluidStack fstack, boolean doDrain) {
+ if (this.canDrain(dir, null)) {
+ return this.fluidTankProducts.drain(fstack, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection dir, int amount, boolean doDrain) {
+ if (this.canDrain(dir, null)) {
+ if (dir.equals(ForgeDirection.UP)) {
+ return this.fluidTankProducts.drainLightest(amount, doDrain);
+ }
+ return this.fluidTankProducts.drain(amount, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection dir, FluidStack fstack, boolean doFill) {
+ if (fstack != null && fstack.getFluid() != null && this.canFill(dir, fstack.getFluid())) {
+ return this.fluidTankInput.fill(fstack, doFill);
+ }
+ return 0;
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection dir) {
+ return new FluidTankInfo[] { this.fluidTankInput.getInfo(), this.fluidTankProducts.getInfo() };
+ }
+
+ @Override
+ public void onNetworkEvent(EntityPlayer player, int event) {
+ switch (event) {
+ case 0:
+ this.fluidTankProducts.setEmpty();
+ break;
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/DosingPumpContainer.java b/src/main/java/ihl/processing/chemistry/DosingPumpContainer.java
new file mode 100644
index 0000000..5a4cb21
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/DosingPumpContainer.java
@@ -0,0 +1,95 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraftforge.fluids.FluidStack;
+
+public class DosingPumpContainer extends ContainerBase<DosingPumpTileEntity> {
+
+ protected DosingPumpTileEntity tileEntity;
+ public int lastFluidAmount = -1;
+ public int lastNumberOfFluids = -1;
+ public short lastProgress = -1;
+ public int lastFluidAmountSetpoint = -1;
+ public short lastEnergy = -1;
+ private final static int height = 166;
+ public List<FluidStack> fluidTankFluidList;
+
+ public DosingPumpContainer(EntityPlayer entityPlayer, DosingPumpTileEntity tileEntity1) {
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList = tileEntity.getFluidTank().getFluidList();
+ int col;
+ for (col = 0; col < 3; ++col) {
+ for (int col1 = 0; col1 < 9; ++col1) {
+ this.addSlotToContainer(
+ new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+ for (col = 0; col < 9; ++col) {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 44, 50));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 44, 14));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 44, 32));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 8, 32));
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+
+ if (this.tileEntity.getTankAmount() != this.lastFluidAmount
+ || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
+
+ if (this.tileEntity.progress != this.lastProgress) {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+
+ if (this.tileEntity.fluidAmountSetpoint != this.lastFluidAmountSetpoint) {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.fluidAmountSetpoint);
+ }
+
+ if ((short) this.tileEntity.energy != this.lastEnergy) {
+ icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
+ }
+ }
+
+ this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
+ this.lastFluidAmount = this.tileEntity.getTankAmount();
+ this.lastProgress = this.tileEntity.progress;
+ this.lastFluidAmountSetpoint = this.tileEntity.fluidAmountSetpoint;
+ this.lastEnergy = (short) this.tileEntity.energy;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value) {
+ super.updateProgressBar(index, value);
+ switch (index) {
+ case 0:
+ this.tileEntity.progress = (short) value;
+ break;
+ case 1:
+ this.tileEntity.fluidAmountSetpoint = (short) value;
+ break;
+ case 2:
+ this.tileEntity.energy = value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/DosingPumpGui.java b/src/main/java/ihl/processing/chemistry/DosingPumpGui.java
new file mode 100644
index 0000000..dde4f13
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/DosingPumpGui.java
@@ -0,0 +1,103 @@
+package ihl.processing.chemistry;
+
+import java.awt.event.KeyEvent;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.ClientProxy;
+import ihl.IHLMod;
+import ihl.utils.IHLRenderUtils;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+
+@SideOnly(Side.CLIENT)
+public class DosingPumpGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIDosingPump.png");
+ private DosingPumpContainer container;
+ private GuiTextField setpointTextField;
+ private int lastFluidAmountSetpoint = -1;
+ private final static int TANK_HEIGHT = 58;
+
+ public DosingPumpGui(DosingPumpContainer container1) {
+ // the container is instanciated and passed to the superclass for
+ // handling
+ super(container1);
+ this.container = container1;
+ setpointTextField = new GuiTextField(Minecraft.getMinecraft().fontRenderer, 106, 34, 62, 16);
+ setpointTextField.setText(Integer.toString(this.container.tileEntity.fluidAmountSetpoint));
+ setpointTextField.setFocused(true);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ if(lastFluidAmountSetpoint!= this.container.tileEntity.fluidAmountSetpoint){
+ setpointTextField.setText(Integer.toString(this.container.tileEntity.fluidAmountSetpoint));
+ lastFluidAmountSetpoint= this.container.tileEntity.fluidAmountSetpoint;
+ }
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12), 12);
+ this.drawTexturedModalRect(12, 15 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ i1 = TANK_HEIGHT - this.container.tileEntity.fluidAmountSetpoint * TANK_HEIGHT
+ / this.container.tileEntity.getFluidTank().getCapacity();
+ this.drawTexturedModalRect(78, 6 + i1, 176, 14, 25, 7);
+ if (this.container.tileEntity.getTankAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 82, 10, 94,
+ 67, zLevel, par1, par2, xOffset, yOffset);
+ }
+ setpointTextField.drawTextBox();
+ IHLRenderUtils.instance.drawTooltip(par1,par2,9,11,xOffset,yOffset,StatCollector.translateToLocal("ihl.dosingPump.tip"));
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ // draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ @Override
+ protected void keyTyped(char characterTyped, int keyIndex) {
+ super.keyTyped(characterTyped, keyIndex);
+ this.setpointTextField.textboxKeyTyped(characterTyped, keyIndex);
+ // 28 - enter; 156 - numpad enter
+ if (keyIndex == KeyEvent.VK_ACCEPT || keyIndex == KeyEvent.VK_ENTER || keyIndex == 28 || keyIndex == 156) {
+ int fluidAmountSetpoint = (short) Math.max(1,
+ Math.min(this.container.tileEntity.getFluidTank().getCapacity(),
+ IHLUtils.parseIntSafe(this.setpointTextField.getText(), 100)));
+ this.setpointTextField.setText(Integer.toString(fluidAmountSetpoint));
+ this.setpointTextField.setFocused(false);
+ ((ClientProxy)IHLMod.proxy).sendIntegerFieldValueFromClientToServer(fluidAmountSetpoint, "fluidAmountSetpoint", this.container.tileEntity);
+ }
+ }
+ @Override
+ public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
+ super.mouseClicked(mouseX, mouseY, mouseButton);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ if (mouseX >= x + setpointTextField.xPosition &&
+ mouseX <= x + setpointTextField.xPosition + setpointTextField.width &&
+ mouseY >= y + setpointTextField.yPosition &&
+ mouseY <= y + setpointTextField.yPosition + setpointTextField.height) {
+ setpointTextField.setFocused(true);
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/DosingPumpTileEntity.java b/src/main/java/ihl/processing/chemistry/DosingPumpTileEntity.java
new file mode 100644
index 0000000..e1e4996
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/DosingPumpTileEntity.java
@@ -0,0 +1,226 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.processing.metallurgy.BasicElectricMotorTileEntity;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class DosingPumpTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler {
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ private final IHLFluidTank fluidTank = new IHLFluidTank(8000);
+ public int fluidAmountSetpoint = 8000;
+ private boolean prevIsPowered = false;
+ private boolean tickFree=false;
+
+ public DosingPumpTileEntity() {
+ super();
+ this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 1);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ this.fluidAmountSetpoint = nbttagcompound.getInteger("fluidAmountSetpoint");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+ nbttagcompound.setInteger("fluidAmountSetpoint", this.fluidAmountSetpoint);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing() != side;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("dosingPump");
+ }
+
+ @Override
+ public boolean enableUpdateEntity() {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void updateEntityServer() {
+ super.updateEntityServer();
+ this.tickFree = true;
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, fluidTank);
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, int amount, boolean doDrain) {
+ switch (from) {
+ case UP:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case NORTH:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case SOUTH:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case WEST:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case EAST:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case DOWN:
+ return this.fluidTank.drain(amount, doDrain);
+ default:
+ return this.fluidTank.drain(amount, doDrain);
+ }
+ }
+
+ // 1.7.10 API
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return !direction.equals(ForgeDirection.getOrientation(this.getFacing()));
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "dosingPump";
+ }
+
+ public float getRenderLiquidLevel() {
+ return (float) this.fluidTank.getFluidAmount() / (float) this.fluidTank.getCapacity();
+ }
+
+ @Override
+ public int gaugeProgressScaled(int i) {
+ return this.progress * i / operationLength;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new DosingPumpGui(new DosingPumpContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ this.fluidTank.sortFluidsByDensity();
+ return new DosingPumpContainer(player, this);
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer player) {
+ }
+
+ @Override
+ public boolean canOperate() {
+ return false;
+ }
+
+ @Override
+ public void operate() {
+ int fluidAmountToDrain = fluidAmountSetpoint;
+ ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing());
+ TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
+ if (te instanceof IFluidHandler) {
+ IFluidHandler fhte = (IFluidHandler) te;
+ for (int i = 0; i < this.fluidTank.getNumberOfFluids(); i++) {
+ FluidStack drained = this.fluidTank.drain(fluidAmountToDrain, true);
+ fluidAmountToDrain -= drained.amount;
+ if (fhte.canFill(dir, drained.getFluid())) {
+ fhte.fill(dir, drained, true);
+ }
+ if (fluidAmountToDrain <= 0) {
+ break;
+ }
+ }
+ }
+ this.energy-=this.energyConsume/10;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) {
+ if (fluidTank.getFluid() != null && fluidTank.getFluid().containsFluid(fluidStack)) {
+ return this.fluidTank.drain(fluidStack, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.fluidTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[] { this.fluidTank.getInfo() };
+ }
+
+ public boolean needsFluid() {
+ return this.fluidTank.getFluidAmount() <= this.fluidTank.getCapacity();
+ }
+
+ public FluidStack getFluidStackfromTank() {
+ return this.fluidTank.getFluid();
+ }
+
+ public int getTankAmount() {
+ return this.fluidTank.getFluidAmount();
+ }
+
+ public int gaugeLiquidScaled(int i, int index) {
+ return this.fluidTank.getFluidAmount() <= 0 ? 0
+ : this.fluidTank.getFluidAmount(index) * i / this.fluidTank.getCapacity();
+ }
+
+ public int getNumberOfFluidsInTank() {
+ return this.fluidTank.getNumberOfFluids();
+ }
+
+ public IHLFluidTank getFluidTank() {
+ return this.fluidTank;
+ }
+
+ @Override
+ public List<?>[] getInput() {
+ return null;
+ }
+
+ public void setPowered(boolean isPowered) {
+ if (isPowered && !prevIsPowered && this.energy > 0 && this.tickFree) {
+ this.operate();
+ }
+ prevIsPowered = isPowered;
+ this.tickFree = false; // Only one operation per tick max
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/ElectricEvaporatorBlock.java b/src/main/java/ihl/processing/chemistry/ElectricEvaporatorBlock.java
new file mode 100644
index 0000000..f65b76d
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ElectricEvaporatorBlock.java
@@ -0,0 +1,220 @@
+package ihl.processing.chemistry;
+
+import java.util.Random;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.IHLCreativeTab;
+import ihl.IHLModInfo;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class ElectricEvaporatorBlock extends Block implements ITileEntityProvider{
+
+ IIcon textureFrontActive, textureSide, textureBottom, textureTop;
+
+ public ElectricEvaporatorBlock(Material material)
+ {
+ super(material);
+ this.setCreativeTab(IHLCreativeTab.tab);
+ }
+
+ @Override
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
+ {
+ return new ItemStack(Blocks.furnace,1).getItem();
+ }
+
+ @Override
+ public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int flag)
+ {
+ ItemStack result = new ItemStack(Blocks.furnace,1);
+ this.dropBlockAsItem(world, x, y, z, result);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new ElectricEvaporatorTileEntity();
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister par1IconRegister)
+ {
+ this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":electricEvaporatorFront");
+ this.textureFrontActive = par1IconRegister.registerIcon(IHLModInfo.MODID + ":electricEvaporatorFrontActive");
+ this.textureSide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":electricEvaporatorSide");
+ this.textureTop = par1IconRegister.registerIcon(IHLModInfo.MODID + ":electricEvaporatorTop");
+ this.textureBottom = par1IconRegister.registerIcon(IHLModInfo.MODID + ":electricEvaporatorBottom");
+ }
+
+ @Override
+ public boolean hasTileEntity(int metadata)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer entityPlayer,int i,float pos_x,float pos_y,float pos_z){
+ TileEntity te = world.getTileEntity(x,y,z);
+ if(te instanceof ElectricEvaporatorTileEntity)
+ {
+ ElectricEvaporatorTileEntity bte = (ElectricEvaporatorTileEntity)te;
+ if (bte == null || entityPlayer.isSneaking()) {
+ return false;
+ }
+ else
+ {
+ return bte.getGui(entityPlayer);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Called when the block is placed in the world.
+ */
+ @Override
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack)
+ {
+ int var7 = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ TileEntity t = world.getTileEntity(x, y, z);
+ if(t!=null && t instanceof ElectricEvaporatorTileEntity)
+ {
+ ElectricEvaporatorTileEntity te = (ElectricEvaporatorTileEntity)t;
+ if(player.isSneaking())
+ {
+ switch(var7)
+ {
+ case 0:
+ te.setFacing((short) 3);
+ break;
+ case 1:
+ te.setFacing((short) 4);
+ break;
+ case 2:
+ te.setFacing((short) 2);
+ break;
+ case 3:
+ te.setFacing((short) 5);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch(var7)
+ {
+ case 0:
+ te.setFacing((short) 2);
+ break;
+ case 1:
+ te.setFacing((short) 5);
+ break;
+ case 2:
+ te.setFacing((short) 3);
+ break;
+ case 3:
+ te.setFacing((short) 4);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
+ {
+ IIcon faceIcon=this.blockIcon;
+ int facing=3;
+ int mask[] = {
+ 0,1,2,3,4,5,
+ 1,0,3,2,4,5,
+ 2,3,0,1,4,5,
+ 2,3,1,0,4,5,
+ 2,3,5,4,0,1,
+ 2,3,4,5,1,0
+ };
+ TileEntity te = world.getTileEntity(x, y, z);
+ if(te!=null)
+ {
+ ElectricEvaporatorTileEntity tebh = (ElectricEvaporatorTileEntity) te;
+ facing=tebh.getFacing();
+ if(tebh.getActive())
+ {
+ faceIcon=this.textureFrontActive;
+ }
+ }
+
+ switch (mask[facing*6+side])
+ {
+ case 0:
+ return faceIcon;
+ case 1:
+ return this.textureSide;
+ case 2:
+ return this.textureBottom;
+ case 3:
+ return this.textureTop;
+ case 4:
+ return this.textureSide;
+ case 5:
+ return this.textureSide;
+ default:
+ return this.textureSide;
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta)
+ {
+ switch (side)
+ {
+ case 0:
+ return this.textureBottom;
+ case 1:
+ return this.textureTop;
+ case 2:
+ return this.textureSide;
+ case 3:
+ return this.blockIcon;
+ case 4:
+ return this.textureSide;
+ case 5:
+ return this.textureSide;
+ default:
+ return this.textureSide;
+ }
+ }
+
+ @Override
+ public void randomDisplayTick(World world, int x, int y, int z, Random random)
+ {
+ TileEntity te = world.getTileEntity(x, y, z);
+ if(te instanceof ElectricEvaporatorTileEntity)
+ {
+ ElectricEvaporatorTileEntity ete = (ElectricEvaporatorTileEntity) te;
+ if(ete.getActive())
+ {
+ world.spawnParticle("snowshovel", x+0.2D, y+1.2D, z+0.2D, 0D, 0.05D, 0D);
+ }
+ }
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/ElectricEvaporatorContainer.java b/src/main/java/ihl/processing/chemistry/ElectricEvaporatorContainer.java
new file mode 100644
index 0000000..d981d94
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ElectricEvaporatorContainer.java
@@ -0,0 +1,113 @@
+package ihl.processing.chemistry;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class ElectricEvaporatorContainer extends ContainerBase<ElectricEvaporatorTileEntity> {
+
+ protected ElectricEvaporatorTileEntity tileEntity;
+ public int lastFluidAmount = -1;
+ public double lastEnergy = -1;
+ public short lastProgress = -1;
+ private final static int height=166;
+
+ public ElectricEvaporatorContainer(EntityPlayer entityPlayer, ElectricEvaporatorTileEntity electricEvaporatorTileEntity){
+ super(electricEvaporatorTileEntity);
+ this.tileEntity = electricEvaporatorTileEntity;
+ int col;
+
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+
+ this.addSlotToContainer(new SlotInvSlot(electricEvaporatorTileEntity.fuelSlot, 0, 8, 32));
+ this.addSlotToContainer(new SlotInvSlot(electricEvaporatorTileEntity.fluidItemsSlot, 0, 44, 14));
+ this.addSlotToContainer(new SlotInvSlot(electricEvaporatorTileEntity.emptyFluidItemsSlot, 0, 44, 32));
+ this.addSlotToContainer(new SlotInvSlot(electricEvaporatorTileEntity.fillItemsSlot, 0, 44, 50));
+ this.addSlotToContainer(new SlotInvSlot(electricEvaporatorTileEntity.outputSlot, 0, 117, 32));
+ for(int row=0;row<=3;row++)
+ {
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.upgradeSlot, row, 152, 8+row*18));
+ }
+
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+
+ if (this.tileEntity.getFluidTank().getFluid()!=null && this.tileEntity.getFluidTank().getFluidAmount() != this.lastFluidAmount)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.getFluidTank().getFluid().getFluid().getID());
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getFluidTank().getFluidAmount());
+ }
+
+ if (this.tileEntity.getEnergy() != this.lastEnergy)
+ {
+ icrafting.sendProgressBarUpdate(this, 2, ((int)this.tileEntity.getEnergy()>>15) & Short.MAX_VALUE);
+ icrafting.sendProgressBarUpdate(this, 3, (short)((int)this.tileEntity.getEnergy() & Short.MAX_VALUE));
+ }
+
+ if (this.tileEntity.progress != this.lastProgress)
+ {
+ icrafting.sendProgressBarUpdate(this, 4, this.tileEntity.progress);
+ icrafting.sendProgressBarUpdate(this, 5, this.tileEntity.maxProgress);
+ }
+ }
+
+ this.lastFluidAmount = this.tileEntity.getFluidTank().getFluidAmount();
+ this.lastEnergy = this.tileEntity.getEnergy();
+ this.lastProgress = this.tileEntity.progress;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+
+ switch (index)
+ {
+ case 0:
+ this.tileEntity.getFluidTank().setFluid(new FluidStack(FluidRegistry.getFluid(value), 1000));
+ break;
+ case 1:
+ this.tileEntity.getFluidTank().setFluid(new FluidStack(this.tileEntity.getFluidTank().getFluid().getFluid(), value));
+ break;
+ case 2:
+ this.tileEntity.setEnergy(value<<15);
+ break;
+ case 3:
+ this.tileEntity.setEnergy(this.tileEntity.getEnergy()+value);
+ break;
+ case 4:
+ this.tileEntity.progress=(short) value;
+ break;
+ case 5:
+ this.tileEntity.maxProgress=(short) value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/ElectricEvaporatorGui.java b/src/main/java/ihl/processing/chemistry/ElectricEvaporatorGui.java
new file mode 100644
index 0000000..4a36631
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ElectricEvaporatorGui.java
@@ -0,0 +1,85 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.util.DrawUtil;
+import ic2.core.util.GuiTooltipHelper;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+@SideOnly(Side.CLIENT)
+public class ElectricEvaporatorGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIElectricEvaporator.png");
+ private ElectricEvaporatorContainer container;
+ private String title = StatCollector.translateToLocal("ihl.gui.electricEvaporator");
+
+ public ElectricEvaporatorGui (ElectricEvaporatorContainer electricEvaporatorContainer) {
+ //the container is instanciated and passed to the superclass for handling
+ super(electricEvaporatorContainer);
+ this.container=electricEvaporatorContainer;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ fontRendererObj.drawString(title, 8, 70, 6171880);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(9, 15 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(18),18);
+ this.drawTexturedModalRect(99, 34, 198, 0, i1 + 1, 13);
+ }
+
+ if (this.container.tileEntity.getFluidTank().getFluid()!=null && this.container.tileEntity.getFluidTank().getFluidAmount() > 0)
+ {
+ FluidStack fluidStack = this.container.tileEntity.getFluidTank().getFluid();
+ if(fluidStack!=null)
+ {
+ Fluid fluid = fluidStack.getFluid();
+ if(fluid!=null)
+ {
+
+ IIcon fluidIcon = fluid.getIcon();
+
+ if (fluidIcon != null)
+ {
+ this.mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
+ int liquidHeight = this.container.tileEntity.gaugeLiquidScaled(47);
+
+ DrawUtil.drawRepeated(fluidIcon, (82), 16 + 47 - liquidHeight, 12.0D, liquidHeight, this.zLevel);
+ this.mc.renderEngine.bindTexture(background);
+ }
+ }
+ String tooltip = StatCollector.translateToLocal(fluidStack.getFluid().getUnlocalizedName()) + ": " + fluidStack.amount + "mB";
+ //GuiTooltiphelper.drawAreaTooltip(par1-90, par2-32, tooltip, xOffset+64, yOffset+23, xOffset+74, yOffset+71);
+ GuiTooltipHelper.drawAreaTooltip(par1-90, par2-32, tooltip, xOffset-8, yOffset-15, xOffset+2, yOffset+30);
+ }
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/ElectricEvaporatorTileEntity.java b/src/main/java/ihl/processing/chemistry/ElectricEvaporatorTileEntity.java
new file mode 100644
index 0000000..cdf3524
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ElectricEvaporatorTileEntity.java
@@ -0,0 +1,430 @@
+package ihl.processing.chemistry;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.energy.event.EnergyTileLoadEvent;
+import ic2.api.energy.event.EnergyTileUnloadEvent;
+import ic2.api.energy.tile.IEnergySink;
+import ic2.api.item.IC2Items;
+import ic2.api.network.INetworkTileEntityEventListener;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.audio.AudioSource;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlot.Access;
+import ic2.core.block.invslot.InvSlotUpgrade;
+import ic2.core.upgrade.IUpgradableBlock;
+import ic2.core.upgrade.IUpgradeItem;
+import ic2.core.upgrade.UpgradableProperty;
+import ihl.IHLMod;
+import ihl.utils.IHLInvSlotDischarge;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class ElectricEvaporatorTileEntity extends EvaporatorTileEntity implements IEnergySink, IUpgradableBlock, INetworkTileEntityEventListener
+{
+ public final InvSlotUpgrade upgradeSlot;
+ private int tier;
+ public int maxStorage;
+ private int defaultMaxStorage;
+ private double energy;
+ public final int defaultEnergyConsume;
+ public final int defaultOperationLength;
+ public final int defaultTier;
+ public int energyConsume;
+ public AudioSource audioSource;
+ private int updateChecksum=0;
+ private boolean addedToEnergyNet=false;
+
+ public ElectricEvaporatorTileEntity()
+ {
+ super();
+ this.defaultEnergyConsume = this.energyConsume = 8;
+ this.defaultOperationLength = this.maxProgress = 400;
+ this.energy=0D;
+ this.tier = this.defaultTier = 1;
+ this.maxStorage = this.defaultMaxStorage = defaultEnergyConsume * defaultOperationLength;
+ this.fuelSlot = new IHLInvSlotDischarge(this, 1, Access.IO, this.tier, InvSlot.InvSide.BOTTOM);
+ this.upgradeSlot = new InvSlotUpgrade(this, "upgrade", 4, 4);
+ }
+
+ @Override
+ public void onLoaded()
+ {
+ super.onLoaded();
+ if (IC2.platform.isSimulating()&&!this.addedToEnergyNet)
+ {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = super.getNetworkedFields();
+ fields.add("tier");
+ fields.add("maxStorage");
+ return fields;
+ }
+
+ public void setOverclockRates()
+ {
+ int speedUp=0;
+ int tierUp=0;
+ int capacityUp=0;
+ int checksum=0;
+ for(int i=0;i<this.upgradeSlot.size();i++)
+ {
+ if(this.upgradeSlot.get(i)!=null)
+ {
+ if(this.upgradeSlot.get(i).getItemDamage()==IC2Items.getItem("overclockerUpgrade").getItemDamage())
+ {
+ speedUp+=this.upgradeSlot.get(i).stackSize;
+ }
+ if(this.upgradeSlot.get(i).getItemDamage()==IC2Items.getItem("transformerUpgrade").getItemDamage())
+ {
+ tierUp+=this.upgradeSlot.get(i).stackSize;
+ }
+ if(this.upgradeSlot.get(i).getItemDamage()==IC2Items.getItem("energyStorageUpgrade").getItemDamage())
+ {
+ capacityUp+=this.upgradeSlot.get(i).stackSize;
+ }
+ }
+ }
+ checksum=speedUp*4096+tierUp*64+capacityUp;
+ if(this.updateChecksum!=checksum)
+ {
+ this.maxProgress=(short)Math.max(this.defaultOperationLength*Math.pow(0.7D, speedUp),2D);
+ this.maxStorage=this.defaultMaxStorage + capacityUp*10000;
+ IC2.network.get().updateTileEntityField(this, "maxStorage");
+ this.energyConsume=(int) Math.min(this.defaultEnergyConsume*Math.pow(1.6D, speedUp),this.maxStorage);
+ this.tier=this.defaultTier+tierUp;
+ IC2.network.get().updateTileEntityField(this, "tier");
+ this.updateChecksum=checksum;
+ };
+ }
+
+ @Override
+ public void onUnloaded()
+ {
+ super.onUnloaded();
+
+ if (IC2.platform.isRendering() && this.audioSource != null)
+ {
+ IC2.audioManager.removeSources(this);
+ this.audioSource = null;
+ }
+
+ if (IC2.platform.isSimulating()&&this.addedToEnergyNet)
+ {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.energy=nbttagcompound.getDouble("energy");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setDouble("energy", this.energy);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=(short)side && side!=0 && side!=1;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ if(this.outputSlot.get()!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.outputSlot.get()));
+ if(this.fuelSlot.get()!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.fuelSlot.get()));
+ if(this.emptyFluidItemsSlot.get()!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.emptyFluidItemsSlot.get()));
+ if(this.upgradeSlot.get(0)!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.upgradeSlot.get(0)));
+ if(this.upgradeSlot.get(1)!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.upgradeSlot.get(1)));
+ if(this.upgradeSlot.get(2)!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.upgradeSlot.get(2)));
+ if(this.upgradeSlot.get(3)!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.upgradeSlot.get(3)));
+ return new ItemStack(IHLMod.electricEvaporatorBlock,1);
+ }
+
+ public int getGUIEnergy(int i)
+ {
+ if(this.energy<Float.MAX_VALUE)
+ {
+ return Math.round((float)this.energy/this.maxStorage*i);
+ }
+ else
+ {
+ return Math.round((float)(this.energy/this.maxStorage)*i);
+ }
+ }
+
+ @Override
+ public boolean enableUpdateEntity()
+ {
+ return true;
+ }
+ @Override
+ public void updateEntityClient()
+ {
+ if(((IHLInvSlotDischarge)this.fuelSlot).tier!=this.tier)
+ {
+ ((IHLInvSlotDischarge)this.fuelSlot).tier=this.tier;
+ }
+ }
+ @Override
+ public void updateEntityServer()
+ {
+ if(((IHLInvSlotDischarge)this.fuelSlot).tier!=this.tier)
+ {
+ ((IHLInvSlotDischarge)this.fuelSlot).tier=this.tier;
+ }
+ if(IC2.platform.isSimulating())
+ {
+ this.setOverclockRates();
+
+ if(this.getDemandedEnergy() > 1.0D)
+ {
+ double amount = ((IHLInvSlotDischarge)this.fuelSlot).discharge(this.getDemandedEnergy(), false);
+ this.energy += amount;
+ }
+ if (this.needsFluid())
+ {
+ IHLUtils.handleFluidSlotsBehaviour(null, fluidItemsSlot, emptyFluidItemsSlot, fluidTank);
+ }
+
+ if (this.canOperate() && this.energy >= this.energyConsume)
+ {
+ this.setActive(true);
+
+ if (this.progress == 0)
+ {
+ IC2.network.get().initiateTileEntityEvent(this, 0, true);
+ }
+ ++this.progress;
+ this.energy -= this.energyConsume;
+ if (this.progress >= this.maxProgress)
+ {
+ this.operate();
+ this.progress = 0;
+ IC2.network.get().initiateTileEntityEvent(this, 2, true);
+ }
+ }
+ else
+ {
+ if (this.progress != 0 && this.getActive())
+ {
+ IC2.network.get().initiateTileEntityEvent(this, 1, true);
+ }
+ if (!this.canOperate())
+ {
+ this.progress = 0;
+ }
+ this.setActive(false);
+ }
+ for (int i = 0; i < this.upgradeSlot.size(); ++i)
+ {
+ ItemStack stack = this.upgradeSlot.get(i);
+
+ if (stack != null && stack.getItem() instanceof IUpgradeItem)
+ {
+ ((IUpgradeItem)stack.getItem()).onTick(stack, this);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onNetworkEvent(int event)
+ {
+ if (this.audioSource == null && this.getStartSoundFile() != null)
+ {
+ this.audioSource = IC2.audioManager.createSource(this, this.getStartSoundFile());
+ }
+
+ switch (event)
+ {
+ case 0:
+ if (this.audioSource != null)
+ {
+ this.audioSource.play();
+ }
+
+ break;
+
+ case 1:
+ if (this.audioSource != null)
+ {
+ this.audioSource.stop();
+ }
+
+ break;
+
+ case 2:
+ if (this.audioSource != null)
+ {
+ this.audioSource.stop();
+ }
+
+ }
+ }
+
+ public String getStartSoundFile()
+ {
+ return "Machines/Electro Furnace/ElectroFurnaceLoop.ogg";
+ }
+
+ /**
+ * Returns the name of the inventory
+ */
+ @Override
+ public String getInventoryName()
+ {
+ return "Electric evaporator";
+ }
+
+ @Override
+ public ContainerBase<ElectricEvaporatorTileEntity> getGuiContainer(EntityPlayer entityPlayer)
+ {
+ return new ElectricEvaporatorContainer(entityPlayer, this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin)
+ {
+ return new ElectricEvaporatorGui(new ElectricEvaporatorContainer(entityPlayer, this));
+ }
+
+ @Override
+ public boolean getGui(EntityPlayer player)
+ {
+ return this instanceof IHasGui ? (IC2.platform.isSimulating() ? IC2.platform.launchGui(player, this) : true) : false;
+ }
+
+ @Override
+ public int mX()
+ {
+ switch(this.getFacing())
+ {
+ case 4:
+ return -1;
+ case 5:
+ return 1;
+ default:
+ return 0;
+ }
+ }
+
+ @Override
+ public int mZ()
+ {
+ switch(this.getFacing())
+ {
+ case 2:
+ return -1;
+ case 3:
+ return 1;
+ default:
+ return 0;
+ }
+ }
+
+ @Override
+ public double getEnergy()
+ {
+ return this.energy;
+ }
+
+ @Override
+ public boolean useEnergy(double amount) {
+ if (this.energy >= amount)
+ {
+ this.energy -= amount;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public void setEnergy(double i) {
+ this.energy=i;
+ }
+
+ @Override
+ public double getDemandedEnergy()
+ {
+ return this.maxStorage - this.energy;
+ }
+
+ @Override
+ public int getSinkTier()
+ {
+ return this.tier;
+ }
+
+ @Override
+ public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
+ {
+ if (this.energy >= this.maxStorage)
+ {
+ return amount;
+ }
+ else
+ {
+ this.energy += amount;
+ return 0.0D;
+ }
+ }
+
+ @Override
+ public boolean acceptsEnergyFrom(TileEntity emitter,
+ ForgeDirection direction) {
+ return true;
+ }
+
+ public ItemStack getOutput(int arg0)
+ {
+ return this.outputSlot.get(arg0);
+ }
+
+ public int getOutputSize() {
+ return this.outputSlot.size();
+ }
+
+ public void setOutput(int arg0, ItemStack arg1)
+ {
+ this.outputSlot.put(arg0, arg1);
+ }
+
+ @Override
+ public Set<UpgradableProperty> getUpgradableProperties()
+ {
+ Set<UpgradableProperty> properties = new HashSet<UpgradableProperty>();
+ properties.add(UpgradableProperty.ItemProducing);
+ properties.add(UpgradableProperty.EnergyStorage);
+ properties.add(UpgradableProperty.Transformer);
+ return properties;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/ElectrolysisBathContainer.java b/src/main/java/ihl/processing/chemistry/ElectrolysisBathContainer.java
new file mode 100644
index 0000000..13a5ddb
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ElectrolysisBathContainer.java
@@ -0,0 +1,79 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraftforge.fluids.FluidStack;
+
+public class ElectrolysisBathContainer extends ContainerBase<ElectrolysisBathTileEntity> {
+
+ protected ElectrolysisBathTileEntity tileEntity;
+ public int lastFluidAmount = -1;
+ public int lastNumberOfFluids = -1;
+ public short lastProgress = -1;
+ public short lastTemperature = -1;
+ private final static int height = 166;
+ public List<FluidStack> fluidTankFluidList;
+ public int fluidListHash = -1;
+
+ public ElectrolysisBathContainer(EntityPlayer entityPlayer, ElectrolysisBathTileEntity tileEntity1) {
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList = this.tileEntity.getFluidTank().getFluidList();
+ int col;
+ for (col = 0; col < 3; ++col) {
+ for (int col1 = 0; col1 < 9; ++col1) {
+ this.addSlotToContainer(
+ new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+ for (col = 0; col < 9; ++col) {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 6, 52));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 6, 16));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 6, 33));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 98, 16));
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (this.fluidListHash != fluidTankFluidList.hashCode()) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ this.fluidListHash = fluidTankFluidList.hashCode();
+ }
+
+ if (this.tileEntity.progress != this.lastProgress) {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+
+ }
+
+ this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
+ this.lastFluidAmount = this.tileEntity.getTankAmount();
+ this.lastProgress = this.tileEntity.progress;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value) {
+ super.updateProgressBar(index, value);
+ switch (index) {
+ case 0:
+ this.tileEntity.progress = (short) value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/ElectrolysisBathGui.java b/src/main/java/ihl/processing/chemistry/ElectrolysisBathGui.java
new file mode 100644
index 0000000..404ef94
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ElectrolysisBathGui.java
@@ -0,0 +1,100 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.IC2;
+import ihl.utils.GuiMultiTextureButton;
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+@SideOnly(Side.CLIENT)
+public class ElectrolysisBathGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIElectrolysisBath.png");
+ private ElectrolysisBathContainer container;
+ private GuiMultiTextureButton button1;
+ private int timer=10;
+
+ public ElectrolysisBathGui (ElectrolysisBathContainer container1) {
+ //the container is instanciated and passed to the superclass for handling
+ super(container1);
+ this.container=container1;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void initGui()
+ {
+ super.initGui();
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ button1=new GuiMultiTextureButton(0, x+97, y+58, 18, 18, background,97,58,238,238);
+ this.buttonList.add(button1);
+ }
+
+ @Override
+ public void actionPerformed(GuiButton button)
+ {
+ super.actionPerformed(button);
+ IC2.network.get().initiateClientTileEntityEvent(this.container.tileEntity, button.id);
+ if (button.id == 0)
+ {
+ button1.isActive=true;
+ timer=10;
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.progress > 0)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27),27);
+ this.drawTexturedModalRect(121, 33, getFrameX(i1), getFrameY(i1),24,24);
+ }
+ if (this.container.tileEntity.getTankAmount() > 0)
+ {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 32, 11, 89, 72, zLevel, par1, par2, xOffset, yOffset);
+ }
+ this.mc.renderEngine.bindTexture(background);
+ this.drawTexturedModalRect(60, 3, 252, 0,4,48);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ if(timer>0)
+ {
+ timer--;
+ }
+ if(timer==1)
+ {
+ button1.isActive=false;
+ }
+ }
+
+ private int getFrameY(int number)
+ {
+ return (number % 10) * 24 + 14;
+ }
+
+ private int getFrameX(int number)
+ {
+ return (number / 10) * 24 + 176;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/ElectrolysisBathModel.java b/src/main/java/ihl/processing/chemistry/ElectrolysisBathModel.java
new file mode 100644
index 0000000..310ec62
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ElectrolysisBathModel.java
@@ -0,0 +1,86 @@
+package ihl.processing.chemistry;
+
+// Date: 12.04.2015 13:06:31
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+
+public class ElectrolysisBathModel extends ModelBase
+{
+ //fields
+ ModelRenderer Piece1;
+ ModelRenderer FrontPylone;
+ ModelRenderer BackPylone;
+ ModelRenderer LeftPylone;
+ ModelRenderer RightPylone;
+
+ public ElectrolysisBathModel()
+ {
+ textureWidth = 64;
+ textureHeight = 128;
+ setTextureOffset("Piece1.Stick01", 48, 4);
+ setTextureOffset("Piece1.Shape1", 16, 18);
+ setTextureOffset("Piece1.Body04", 0, 48);
+ setTextureOffset("Piece1.Shape2", 0, 18);
+ setTextureOffset("Piece1.Shape3", 16, 0);
+ setTextureOffset("Piece1.Shape4", 0, 0);
+ setTextureOffset("Piece1.Box01", 41, 18);
+ setTextureOffset("Piece1.Shape5", 23, 84);
+ setTextureOffset("Piece1.Shape6", 23, 84);
+ setTextureOffset("Piece1.Shape7", 23, 84);
+ setTextureOffset("Piece1.Shape8", 23, 83);
+ setTextureOffset("FrontPylone.Shape9", 23, 84);
+ setTextureOffset("BackPylone.Shape10", 23, 84);
+ setTextureOffset("LeftPylone.Shape12", 23, 84);
+ setTextureOffset("RightPylone.Shape11", 23, 82);
+
+ Piece1 = new ModelRenderer(this, "Piece1");
+ Piece1.setRotationPoint(0F, 16F, 0F);
+ setRotation(Piece1, 0F, 0F, 0F);
+ Piece1.mirror = false;
+ Piece1.addBox("Stick01", -1F, -16F, -1F, 2, 9, 2);
+ Piece1.addBox("Shape1", -8F, -8F, -8F, 2, 16, 14);
+ Piece1.addBox("Body04", -6F, -7F, -6F, 12, 15, 12);
+ Piece1.addBox("Shape2", 6F, -8F, -6F, 2, 16, 14);
+ Piece1.addBox("Shape3", -6F, -8F, -8F, 14, 16, 2);
+ Piece1.addBox("Shape4", -8F, -8F, 6F, 14, 16, 2);
+ Piece1.addBox("Box01", -2F, -13F, -2F, 4, 2, 4);
+ Piece1.addBox("Shape5", 5F, -9F, -1.5F, 2, 2, 3);
+ Piece1.addBox("Shape6", -7F, -9F, -1.5F, 2, 2, 3);
+ Piece1.addBox("Shape7", -1.5F, -9F, 5F, 3, 2, 2);
+ Piece1.addBox("Shape8", -1.5F, -9F, -7F, 3, 2, 2);
+ FrontPylone = new ModelRenderer(this, "FrontPylone");
+ FrontPylone.setRotationPoint(0F, 7F, -5F);
+ setRotation(FrontPylone, -0.9F, 0F, 0);
+ FrontPylone.mirror = true;
+ FrontPylone.addBox("Shape9", -1F, -5F, -1F, 2, 6, 1);
+ BackPylone = new ModelRenderer(this, "BackPylone");
+ BackPylone.setRotationPoint(0F, 7F, 5F);
+ setRotation(BackPylone, 0.9F, 0F, 0F);
+ BackPylone.mirror = true;
+ BackPylone.addBox("Shape10", -1F, -5F, 0F, 2, 6, 1);
+ LeftPylone = new ModelRenderer(this, "LeftPylone");
+ LeftPylone.setRotationPoint(5F, 7F, 0F);
+ setRotation(LeftPylone, 0F, 0F, -0.9F);
+ LeftPylone.mirror = true;
+ LeftPylone.addBox("Shape12", 0F, -5F, -1F, 1, 6, 2);
+ RightPylone = new ModelRenderer(this, "RightPylone");
+ RightPylone.setRotationPoint(-5F, 7F, 0F);
+ setRotation(RightPylone, 0, 0F, 0.9F);
+ RightPylone.mirror = true;
+ RightPylone.addBox("Shape11", -1F, -5F, -1F, 1, 6, 2);
+ }
+
+ private void setRotation(ModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/ElectrolysisBathTileEntity.java b/src/main/java/ihl/processing/chemistry/ElectrolysisBathTileEntity.java
new file mode 100644
index 0000000..ea98a34
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ElectrolysisBathTileEntity.java
@@ -0,0 +1,297 @@
+package ihl.processing.chemistry;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.network.INetworkClientTileEntityEventListener;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlot.Access;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.flexible_cable.FlexibleCableHolderBaseTileEntity;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class ElectrolysisBathTileEntity extends FlexibleCableHolderBaseTileEntity implements IHasGui, INetworkClientTileEntityEventListener, IFluidHandler
+{
+ private final static UniversalRecipeManager recipeManager = new UniversalRecipeManager("electrolysisbath");
+ public final ApparatusProcessableInvSlot input;
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ public short progress;
+ protected short operationLength=20000;//Short.MAX_VALUE=32767
+ private final IHLFluidTank fluidTank = new IHLFluidTank(2000);
+ private final static double resistance=5D;
+
+ public ElectrolysisBathTileEntity() {
+ super();
+ this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 1);
+ this.input = new ApparatusProcessableInvSlot(this, "input", 3, Access.IO, 1, 64);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return false;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("electrolysisBath");
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, fluidTank);
+ if (this.canOperate())
+ {
+ this.setActive(true);
+ if (this.progress == 0)
+ {
+ IC2.network.get().initiateTileEntityEvent(this, 0, true);
+ }
+ if(gridID!=-1 && this.getGrid().energy>0D)
+ {
+ double drawEnergy = getEnergyAmountThisNodeWant();
+ this.progress+=drawEnergy;
+ this.getGrid().drawEnergy(drawEnergy, this);
+ }
+
+ if (this.progress >= this.operationLength)
+ {
+ this.operate();
+ this.progress = 0;
+ IC2.network.get().initiateTileEntityEvent(this, 2, true);
+ }
+ }
+ else
+ {
+ if (this.progress != 0 && this.getActive())
+ {
+ IC2.network.get().initiateTileEntityEvent(this, 1, true);
+ }
+ if (!this.canOperate())
+ {
+ this.progress = 0;
+ }
+ this.setActive(false);
+ }
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, int amount, boolean doDrain)
+ {
+ FluidStack fstack = this.fluidTank.drain(amount, doDrain);
+ return fstack;
+ }
+
+
+ //1.7.10 API
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "Electrolysis bath";
+ }
+
+ @Override
+ public void onNetworkEvent(EntityPlayer player, int event)
+ {
+ TileEntity te = worldObj.getTileEntity(xCoord, yCoord-1, zCoord);
+ if(te instanceof IFluidHandler && this.fluidTank.getFluid()!=null)
+ {
+ IFluidHandler ifhte = (IFluidHandler)te;
+ if(ifhte.canFill(ForgeDirection.UP, this.fluidTank.getFluid().getFluid()))
+ {
+ int filled = ifhte.fill(ForgeDirection.UP, this.fluidTank.drain(this.getTankAmount(), false), true);
+ this.fluidTank.drain(filled, true);
+ }
+ }
+ }
+
+ public int gaugeProgressScaled(int i)
+ {
+ return this.progress * i / operationLength;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new ElectrolysisBathGui(new ElectrolysisBathContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player)
+ {
+ this.fluidTank.sortFluidsByDensity();
+ return new ElectrolysisBathContainer(player, this);
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer player) {}
+
+ public boolean canOperate()
+ {
+ return getOutput()!=null;
+ }
+
+ public UniversalRecipeOutput getOutput()
+ {
+ return ElectrolysisBathTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List[] getInput()
+ {
+ for(int i=0;i<fluidTank.getNumberOfFluids();i++)
+ {
+ List[] rInput = new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid(i)}), this.input.getItemStackList()};
+ if(ElectrolysisBathTileEntity.recipeManager.getOutputFor(rInput)!=null)
+ {
+ return rInput;
+ }
+ }
+ return new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid()}), this.input.getItemStackList()};
+ }
+
+ public void operate() {
+ if (this.fluidTank.getCapacity() > this.fluidTank.getFluidAmount()) {
+ UniversalRecipeInput recipeInput = ElectrolysisBathTileEntity.recipeManager.getRecipeInput(getInput());
+ UniversalRecipeOutput output1 = getOutput();
+ for (int i = 0; i < recipeInput.getItemInputs().size(); i++) {
+ this.input.consume(recipeInput.getItemInputs().get(i));
+ }
+ this.fluidTank.fill(output1.getFluidOutputs(), true);
+ }
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) {
+ if(fluidTank.getFluid()!=null && fluidTank.getFluid().containsFluid(fluidStack))
+ {
+ return this.fluidTank.drain(fluidStack, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.fluidTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[] {this.fluidTank.getInfo()};
+ }
+
+ public boolean needsFluid()
+ {
+ return this.fluidTank.getFluidAmount() <= this.fluidTank.getCapacity();
+ }
+
+ public FluidStack getFluidStackfromTank()
+ {
+ return this.fluidTank.getFluid();
+ }
+
+ public int getTankAmount()
+ {
+ return this.fluidTank.getFluidAmount();
+ }
+
+ public int gaugeLiquidScaled(int i, int index)
+ {
+ return this.fluidTank.getFluidAmount() <= 0 ? 0 : this.fluidTank.getFluidAmount(index) * i / this.fluidTank.getCapacity();
+ }
+ public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output)
+ {
+ recipeManager.addRecipe(input, output);
+ }
+
+ public int getNumberOfFluidsInTank()
+ {
+ return this.fluidTank.getNumberOfFluids();
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ public IHLFluidTank getFluidTank()
+ {
+ return this.fluidTank;
+ }
+
+ @Override
+ public double getMaxAllowableVoltage()
+ {
+ return 64000D;
+ }
+
+ @Override
+ public double getEnergyAmountThisNodeWant()
+ {
+ double voltage = this.getGrid().getSinkVoltage(this);
+ double energy = voltage*voltage/resistance;
+ return this.getOutput()!=null?energy>1d?energy:1d:0d;
+ }
+
+ @Override
+ public void injectEnergyInThisNode(double amount, double voltage)
+ {
+ this.progress+=amount;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/EvaporatorBlock.java b/src/main/java/ihl/processing/chemistry/EvaporatorBlock.java
new file mode 100644
index 0000000..6994176
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/EvaporatorBlock.java
@@ -0,0 +1,221 @@
+package ihl.processing.chemistry;
+
+import java.util.Random;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.IHLCreativeTab;
+import ihl.IHLModInfo;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class EvaporatorBlock extends Block implements ITileEntityProvider{
+
+ IIcon textureFrontActive, textureSide, textureBottom, textureTop;
+
+ public EvaporatorBlock(Material material)
+ {
+ super(material);
+ this.setCreativeTab(IHLCreativeTab.tab);
+ }
+
+ @Override
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
+ {
+ return new ItemStack(Blocks.furnace,1).getItem();
+ }
+
+ @Override
+ public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int flag)
+ {
+ ItemStack result = new ItemStack(Blocks.furnace,1);
+ this.dropBlockAsItem(world, x, y, z, result);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new EvaporatorTileEntity();
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister par1IconRegister)
+ {
+ this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":solidFuelEvaporatorFront");
+ this.textureFrontActive = par1IconRegister.registerIcon(IHLModInfo.MODID + ":solidFuelEvaporatorFrontActive");
+ this.textureSide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":solidFuelEvaporatorSide");
+ this.textureTop = par1IconRegister.registerIcon(IHLModInfo.MODID + ":solidFuelEvaporatorTop");
+ this.textureBottom = par1IconRegister.registerIcon(IHLModInfo.MODID + ":solidFuelEvaporatorBottom");
+ }
+
+ @Override
+ public boolean hasTileEntity(int metadata)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer entityPlayer,int i,float pos_x,float pos_y,float pos_z){
+ TileEntity te = world.getTileEntity(x,y,z);
+ if(te instanceof EvaporatorTileEntity)
+ {
+ EvaporatorTileEntity bte = (EvaporatorTileEntity)te;
+ if (bte == null || entityPlayer.isSneaking()) {
+ return false;
+ }
+ else
+ {
+ return bte.getGui(entityPlayer);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Called when the block is placed in the world.
+ */
+ @Override
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack)
+ {
+ int var7 = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ TileEntity t = world.getTileEntity(x, y, z);
+ if(t!=null && t instanceof EvaporatorTileEntity)
+ {
+ EvaporatorTileEntity te = (EvaporatorTileEntity)t;
+ if(player.isSneaking())
+ {
+ switch(var7)
+ {
+ case 0:
+ te.setFacing((short) 3);
+ break;
+ case 1:
+ te.setFacing((short) 4);
+ break;
+ case 2:
+ te.setFacing((short) 2);
+ break;
+ case 3:
+ te.setFacing((short) 5);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch(var7)
+ {
+ case 0:
+ te.setFacing((short) 2);
+ break;
+ case 1:
+ te.setFacing((short) 5);
+ break;
+ case 2:
+ te.setFacing((short) 3);
+ break;
+ case 3:
+ te.setFacing((short) 4);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
+ {
+ IIcon faceIcon=this.blockIcon;
+ int facing=3;
+ int mask[] = {
+ 0,1,2,3,4,5,
+ 1,0,3,2,4,5,
+ 2,3,0,1,4,5,
+ 2,3,1,0,4,5,
+ 2,3,5,4,0,1,
+ 2,3,4,5,1,0
+ };
+ TileEntity te = world.getTileEntity(x, y, z);
+ if(te!=null)
+ {
+ EvaporatorTileEntity tebh = (EvaporatorTileEntity) te;
+ facing=tebh.getFacing();
+ if(tebh.getActive())
+ {
+ faceIcon=this.textureFrontActive;
+ }
+ }
+
+ switch (mask[facing*6+side])
+ {
+ case 0:
+ return faceIcon;
+ case 1:
+ return this.textureSide;
+ case 2:
+ return this.textureBottom;
+ case 3:
+ return this.textureTop;
+ case 4:
+ return this.textureSide;
+ case 5:
+ return this.textureSide;
+ default:
+ return this.textureSide;
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta)
+ {
+ switch (side)
+ {
+ case 0:
+ return this.textureTop;
+ case 1:
+ return this.textureBottom;
+ case 2:
+ return this.textureSide;
+ case 3:
+ return this.blockIcon;
+ case 4:
+ return this.textureSide;
+ case 5:
+ return this.textureSide;
+ default:
+ return this.textureSide;
+ }
+ }
+
+ @Override
+ public void randomDisplayTick(World world, int x, int y, int z, Random random)
+ {
+ TileEntity te = world.getTileEntity(x, y, z);
+ if(te instanceof EvaporatorTileEntity)
+ {
+ EvaporatorTileEntity ete = (EvaporatorTileEntity) te;
+ if(ete.getActive())
+ {
+ world.spawnParticle("snowshovel", x+0.2D, y+1.2D, z+0.2D, 0D, 0.05D, 0D);
+ world.spawnParticle("flame", x+0.5D+ete.mX()*0.5D+(random.nextDouble()*0.4D-0.2D)*ete.mZ(), y+random.nextDouble()*0.25D, z+0.5D+ete.mZ()*0.5D+(random.nextDouble()*0.4D-0.2D)*ete.mX(), 0D, 0.01D, 0D);
+ }
+ }
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/EvaporatorContainer.java b/src/main/java/ihl/processing/chemistry/EvaporatorContainer.java
new file mode 100644
index 0000000..cb83269
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/EvaporatorContainer.java
@@ -0,0 +1,100 @@
+package ihl.processing.chemistry;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class EvaporatorContainer extends ContainerBase<EvaporatorTileEntity> {
+
+ protected EvaporatorTileEntity tileEntity;
+ public int lastFluidAmount = -1;
+ public int lastFuel = -1;
+ public short lastProgress = -1;
+ private final static int height=166;
+
+ public EvaporatorContainer(EntityPlayer entityPlayer, EvaporatorTileEntity tileEntity1){
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ int col;
+
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fuelSlot, 0, 8, 32));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fluidItemsSlot, 0, 44, 14));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 44, 32));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillItemsSlot, 0, 44, 50));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 117, 32));
+
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+
+ if (this.tileEntity.getFluidTank().getFluid()!=null && this.tileEntity.getFluidTank().getFluidAmount() != this.lastFluidAmount)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.getFluidTank().getFluid().getFluid().getID());
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getFluidTank().getFluidAmount());
+ }
+
+ if (this.tileEntity.fuel != this.lastFuel)
+ {
+ icrafting.sendProgressBarUpdate(this, 2, this.tileEntity.fuel);
+ }
+
+ if (this.tileEntity.progress != this.lastProgress)
+ {
+ icrafting.sendProgressBarUpdate(this, 3, this.tileEntity.progress);
+ }
+ }
+
+ this.lastFluidAmount = this.tileEntity.getFluidTank().getFluidAmount();
+ this.lastFuel = this.tileEntity.fuel;
+ this.lastProgress = this.tileEntity.progress;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+
+ switch (index)
+ {
+ case 0:
+ this.tileEntity.getFluidTank().setFluid(new FluidStack(FluidRegistry.getFluid(value), 1000));
+ break;
+ case 1:
+ this.tileEntity.getFluidTank().setFluid(new FluidStack(this.tileEntity.getFluidTank().getFluid().getFluid(), value));
+ break;
+ case 2:
+ this.tileEntity.fuel=value;
+ break;
+ case 3:
+ this.tileEntity.progress=(short) value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/EvaporatorGui.java b/src/main/java/ihl/processing/chemistry/EvaporatorGui.java
new file mode 100644
index 0000000..05f7c31
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/EvaporatorGui.java
@@ -0,0 +1,84 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.util.DrawUtil;
+import ic2.core.util.GuiTooltipHelper;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+@SideOnly(Side.CLIENT)
+public class EvaporatorGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUISolidFuelEvaporator.png");
+ private EvaporatorContainer container;
+ private String title = StatCollector.translateToLocal("ihl.gui.evaporator");
+
+
+ public EvaporatorGui (EvaporatorContainer container1) {
+ //the container is instanciated and passed to the superclass for handling
+ super(container1);
+ this.container=container1;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ fontRendererObj.drawString(title, 8, 70, 6171880);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.fuel > 0)
+ {
+ i1 = Math.min(this.container.tileEntity.gaugeFuelScaled(12),12);
+ this.drawTexturedModalRect(9, 16 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(18),18);
+ this.drawTexturedModalRect(99, 34, 198, 0, i1 + 1, 13);
+ }
+
+ if (this.container.tileEntity.getTankAmount() > 0)
+ {
+ FluidStack fluidStack = this.container.tileEntity.getFluidTank().getFluid();
+ if(fluidStack!=null)
+ {
+ Fluid fluid = fluidStack.getFluid();
+ if(fluid!=null)
+ {
+
+ IIcon fluidIcon = fluid.getIcon();
+
+ if (fluidIcon != null)
+ {
+ this.mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
+ int liquidHeight = this.container.tileEntity.gaugeLiquidScaled(47);
+ DrawUtil.drawRepeated(fluidIcon, (82), 16 + 47 - liquidHeight, 12.0D, liquidHeight, this.zLevel);
+ this.mc.renderEngine.bindTexture(background);
+ }
+ }
+ String tooltip = StatCollector.translateToLocal(fluidStack.getFluid().getUnlocalizedName()) + ": " + fluidStack.amount + "mB";
+ GuiTooltipHelper.drawAreaTooltip(par1-90, par2-32, tooltip, xOffset-8, yOffset-15, xOffset+2, yOffset+30);
+ }
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/EvaporatorTileEntity.java b/src/main/java/ihl/processing/chemistry/EvaporatorTileEntity.java
new file mode 100644
index 0000000..279fa17
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/EvaporatorTileEntity.java
@@ -0,0 +1,290 @@
+package ihl.processing.chemistry;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.item.IC2Items;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.block.TileEntityLiquidTankInventory;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlotConsumableFuel;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.IHLMod;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class EvaporatorTileEntity extends TileEntityLiquidTankInventory implements IHasGui
+{
+ public final IHLInvSlotOutput outputSlot;
+ public InvSlot fuelSlot;
+ public final InvSlotConsumableLiquidIHL fluidItemsSlot;
+ public final InvSlotConsumableLiquidIHL fillItemsSlot;
+ public final InvSlotOutput emptyFluidItemsSlot;
+
+ public short progress = 0;
+ public short maxProgress = 450;
+ public int fuel = 0;
+ public int maxFuel = 0;
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("evaporator");
+
+ public EvaporatorTileEntity()
+ {
+ super(8);
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
+ this.fuelSlot = new InvSlotConsumableFuel(this, "fuel", 1, 1, true);
+ this.fluidItemsSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", 2, InvSlot.Access.I, 1, InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillItemsSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", 4, InvSlot.Access.I, 1, InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Fill);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 3, 1);
+ }
+
+ public static void init()
+ {
+ addRecipe(new FluidStack(FluidRegistry.getFluid("fluidrubbertreesap"),200), IC2Items.getItem("resin"));
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+
+ try
+ {
+ this.fuel = nbttagcompound.getInteger("fuel");
+ }
+ catch (Throwable var4)
+ {
+ this.fuel = nbttagcompound.getShort("fuel");
+ }
+
+ try
+ {
+ this.maxFuel = nbttagcompound.getInteger("maxFuel");
+ }
+ catch (Throwable var3)
+ {
+ this.maxFuel = nbttagcompound.getShort("maxFuel");
+ }
+
+ this.progress = nbttagcompound.getShort("progress");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setInteger("fuel", this.fuel);
+ nbttagcompound.setInteger("maxFuel", this.maxFuel);
+ nbttagcompound.setShort("progress", this.progress);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=(short)side && side!=0 && side!=1;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ if(this.outputSlot.get()!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.outputSlot.get()));
+ if(this.fuelSlot.get()!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.fuelSlot.get()));
+ if(this.emptyFluidItemsSlot.get()!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.emptyFluidItemsSlot.get()));
+ return new ItemStack(IHLMod.evaporatorBlock,1);
+ }
+
+ public int gaugeProgressScaled(int i)
+ {
+ return this.progress * i / maxProgress;
+ }
+
+ public int gaugeFuelScaled(int i)
+ {
+ if (this.maxFuel == 0)
+ {
+ this.maxFuel = this.fuel;
+
+ if (this.maxFuel == 0)
+ {
+ this.maxFuel = 160;
+ }
+ }
+
+ return this.fuel * i / this.maxFuel;
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ if (this.needsFluid())
+ {
+ IHLUtils.handleFluidSlotsBehaviour(fillItemsSlot, fluidItemsSlot, emptyFluidItemsSlot, fluidTank);
+ }
+ if (this.fuel <= 0 && this.canOperate() && this.fuelSlot instanceof InvSlotConsumableFuel)
+ {
+ this.fuel = this.maxFuel = ((InvSlotConsumableFuel) this.fuelSlot).consumeFuel();
+ }
+
+ if (this.isBurning() && this.canOperate())
+ {
+ ++this.progress;
+
+ if (this.progress >= maxProgress)
+ {
+ this.progress = 0;
+ this.operate();
+ }
+ }
+ else
+ {
+ this.progress = 0;
+ }
+
+ if (this.fuel > 0)
+ {
+ --this.fuel;
+ }
+
+ if (this.getActive() != this.isBurning())
+ {
+ this.setActive(this.isBurning());
+ }
+ }
+
+ public void operate()
+ {
+ UniversalRecipeOutput output = this.getOutput();
+ if(output!=null && !output.getItemOutputs().isEmpty())
+ {
+ this.outputSlot.add(this.getOutput().getItemOutputs().get(0).copy());
+ }
+ this.fluidTank.drain(recipeManager.getRecipeInput(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null).getFluidInputs().get(0).getAmount(), true);
+ }
+
+ public boolean isBurning()
+ {
+ return this.fuel > 0;
+ }
+
+ public boolean canOperate()
+ {
+ if (this.fluidTank.getFluid()==null)
+ {
+ return false;
+ }
+ else
+ {
+ UniversalRecipeOutput output = recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null);
+ return output == null ? false : (this.outputSlot.canAdd(output.getItemOutputs()) ? true : false);
+ }
+ }
+
+ /**
+ * Returns the name of the inventory
+ */
+ @Override
+ public String getInventoryName()
+ {
+ return "Solid fuel evaporator";
+ }
+
+ @Override
+ public ContainerBase<? extends EvaporatorTileEntity> getGuiContainer(EntityPlayer entityPlayer)
+ {
+ return new EvaporatorContainer(entityPlayer, this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin)
+ {
+ return new EvaporatorGui(new EvaporatorContainer(entityPlayer, this));
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer entityPlayer) {}
+
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return false;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection arg0, Fluid fluid1) {
+ return true;
+ }
+
+ public boolean getGui(EntityPlayer player)
+ {
+ return this instanceof IHasGui ? (IC2.platform.isSimulating() ? IC2.platform.launchGui(player, this) : true) : false;
+ }
+
+ public int mX()
+ {
+ switch(this.getFacing())
+ {
+ case 4:
+ return -1;
+ case 5:
+ return 1;
+ default:
+ return 0;
+ }
+ }
+
+ public int mZ()
+ {
+ switch(this.getFacing())
+ {
+ case 2:
+ return -1;
+ case 3:
+ return 1;
+ default:
+ return 0;
+ }
+ }
+
+ public static void addRecipe(FluidStack input, ItemStack output)
+ {
+ recipeManager.addRecipe(new UniversalRecipeInput((new FluidStack [] {input}),null), new UniversalRecipeOutput(null, (new ItemStack[] {output}),20));
+ }
+
+ public UniversalRecipeOutput getOutput()
+ {
+ if (this.fluidTank.getFluid()==null)
+ {
+ return null;
+ }
+ else
+ {
+ UniversalRecipeOutput output = recipeManager.getOutputFor(Arrays.asList(new FluidStack [] {this.fluidTank.getFluid()}),null);
+ return output == null ? null : (this.outputSlot.canAdd(output.getItemOutputs()) ? output : null);
+ }
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/ExtruderModel.java b/src/main/java/ihl/processing/chemistry/ExtruderModel.java
new file mode 100644
index 0000000..4d4688a
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/ExtruderModel.java
@@ -0,0 +1,100 @@
+package ihl.processing.chemistry;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class ExtruderModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+ IHLModelRenderer RotatingPart2;
+ IHLModelRenderer MotorPart1;
+ IHLModelRenderer MotorPart2;
+ IHLModelRenderer Belt;
+ IHLModelRenderer Belt2;
+ IHLModelRenderer Extruder;
+
+ public ExtruderModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 0);
+ setTextureOffset("Base.Shape3", 0, 0);
+ setTextureOffset("Base.Shape16", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN7", 49, 23);
+ setTextureOffset("RotatingPart2.PipeN4", 0, 7);
+ setTextureOffset("MotorPart1.PipeN41", 0, 0);
+ setTextureOffset("MotorPart1.PipeN12", 0, 0);
+ setTextureOffset("MotorPart1.PipeN13", 0, 0);
+ setTextureOffset("MotorPart2.Shape4", 0, 24);
+ setTextureOffset("MotorPart2.Shape7", 0, 9);
+ setTextureOffset("MotorPart2.Shape10", 0, 9);
+ setTextureOffset("Belt.Shape12", 0, 0);
+ setTextureOffset("Belt2.Shape13", 0, 0);
+ setTextureOffset("Extruder.PipeN16", 0, 0);
+ setTextureOffset("Extruder.PipeN15", 24, 20);
+ setTextureOffset("Extruder.Shape8", 0, 0);
+ setTextureOffset("Extruder.PipeU17", 0, 0);
+ setTextureOffset("Extruder.PipeUC18", 0, 0);
+ setTextureOffset("Extruder.Shape14", 0, 0);
+ setTextureOffset("Extruder.PipeN14", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, -8F, 16, 1, 16);
+ Base.addBox("Shape3", -5F, 0F, -7F, 4, 7, 1);
+ Base.addBox("Shape16", 3F, 3F, -6F, 3, 4, 1);
+ RotatingPart2 = new IHLModelRenderer(this, "RotatingPart2");
+ RotatingPart2.setRotationPoint(-3F, 18F, -7F);
+ setRotation(RotatingPart2, 0F, 0F, 0F);
+ RotatingPart2.mirror = true;
+ RotatingPart2.addTube("PipeN7", -2.5F, -2.5F, -1F, 5, 5, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("PipeN4", -1F, -1F, 1F, 2, 2, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1 = new IHLModelRenderer(this, "MotorPart1");
+ MotorPart1.setRotationPoint(4.5F, 20.5F, 0F);
+ setRotation(MotorPart1, 0F, 0F, 0F);
+ MotorPart1.mirror = true;
+ MotorPart1.addTube("PipeN41", -1.5F, -1.5F, -8F, 3, 3, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN12", -0.5F, -0.5F, -7F, 1, 1, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN13", -1.5F, -1.5F, -5F, 3, 3, 5, 0F,1F,ForgeDirection.NORTH);
+ MotorPart2 = new IHLModelRenderer(this, "MotorPart2");
+ MotorPart2.setRotationPoint(0F, 16F, 0F);
+ setRotation(MotorPart2, 0F, 0F, 0F);
+ MotorPart2.mirror = true;
+ MotorPart2.addBox("Shape4", 3F, 3F, 0F, 3, 4, 4);
+ MotorPart2.addBox("Shape7", 6F, 3F, -5F, 2, 4, 5);
+ MotorPart2.addBox("Shape10", 1F, 3F, -5F, 2, 4, 5);
+ Belt = new IHLModelRenderer(this, "Belt");
+ Belt.setRotationPoint(-3F, 15.5F, -7.9F);
+ setRotation(Belt, 0F, 0F, 0.45F);
+ Belt.mirror = true;
+ Belt.addBox("Shape12", 0.5F, 0F, 0F, 8, 1, 1);
+ Belt2 = new IHLModelRenderer(this, "Belt2");
+ Belt2.setRotationPoint(-3F, 19.5F, -7.9F);
+ setRotation(Belt2, 0F, 0F, 0.19F);
+ Belt2.mirror = true;
+ Belt2.addBox("Shape13", 0F, 0F, 0F, 8, 1, 1);
+ Extruder = new IHLModelRenderer(this, "Extruder");
+ Extruder.setRotationPoint(0F, 16F, 0F);
+ setRotation(Extruder, 0F, 0F, 0F);
+ Extruder.mirror = true;
+ Extruder.addTube("PipeN16", -4.5F, 0.5F, -5F, 3, 3, 12, 0F,1F,ForgeDirection.NORTH);
+ Extruder.addTube("PipeN15", -5.5F, -0.5F, 0F, 5, 5, 7, 0.5F,1F,ForgeDirection.NORTH);
+ Extruder.addBox("Shape8", -5F, 4F, 6.9F, 4, 3, 1);
+ Extruder.addTube("PipeU17", -5.5F, -8F, -5F, 5, 8, 5, 0.8F,1F,ForgeDirection.UP);
+ Extruder.addTube("PipeUC18", -5.5F, 0F, -5F, 5, 2, 5, 0.8F,0.6F,ForgeDirection.UP);
+ Extruder.addBox("Shape14", -5F, 3F, -4.9F, 4, 4, 1);
+ Extruder.addTube("PipeN14", -5.5F, -0.5F, 7F, 5, 5, 1, 0.5F,1F,ForgeDirection.NORTH);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/FluidizedBedReactorContainer.java b/src/main/java/ihl/processing/chemistry/FluidizedBedReactorContainer.java
new file mode 100644
index 0000000..ada1463
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/FluidizedBedReactorContainer.java
@@ -0,0 +1,44 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraftforge.fluids.FluidStack;
+
+public class FluidizedBedReactorContainer extends BasicElectricMotorContainer<FluidizedBedReactorTileEntity> {
+
+ protected FluidizedBedReactorTileEntity tileEntity;
+ public int lastFluidsHash = -1;
+ private final static int height=166;
+ public List<FluidStack> fluidTankFluidList;
+
+ public FluidizedBedReactorContainer(EntityPlayer entityPlayer, FluidizedBedReactorTileEntity tileEntity1){
+ super(entityPlayer, tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList = this.tileEntity.getFluidTank().getFluidList();
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 102, 51));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 102, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 102, 33));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 41, 23));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 41, 41));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 76, 33));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ if (fluidTankFluidList.hashCode() != this.lastFluidsHash)
+ {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ this.lastFluidsHash = fluidTankFluidList.hashCode();
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/FluidizedBedReactorGui.java b/src/main/java/ihl/processing/chemistry/FluidizedBedReactorGui.java
new file mode 100644
index 0000000..95ba8f0
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/FluidizedBedReactorGui.java
@@ -0,0 +1,59 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+@SideOnly(Side.CLIENT)
+public class FluidizedBedReactorGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl",
+ "textures/gui/GUIFluidizedBedReactor.png");
+ private FluidizedBedReactorContainer container;
+ private int mixerFrame = 0;
+
+ public FluidizedBedReactorGui(FluidizedBedReactorContainer container1) {
+ // the container is instanciated and passed to the superclass for
+ // handling
+ super(container1);
+ this.container = container1;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D) {
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12), 12);
+ this.drawTexturedModalRect(12, 16 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0) {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17), 17);
+ this.drawTexturedModalRect(58, 34, 198, 0, i1, 13);
+ if (mixerFrame++ > 3) {
+ mixerFrame = 0;
+ }
+ this.drawTexturedModalRect(126, 31, 244, 126 + 26 * mixerFrame, 12, 26);
+ }
+ if (this.container.tileEntity.getTankAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 126, 28, 138, 59,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ // draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java b/src/main/java/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java
new file mode 100644
index 0000000..69dd4e1
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/FluidizedBedReactorTileEntity.java
@@ -0,0 +1,318 @@
+package ihl.processing.chemistry;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlot.Access;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.IHLMod;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.processing.metallurgy.BasicElectricMotorTileEntity;
+import ihl.recipes.RecipeOutputItemStack;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class FluidizedBedReactorTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler
+{
+ private final static UniversalRecipeManager recipeManager = new UniversalRecipeManager("fluidizedbedreactor");
+ public final ApparatusProcessableInvSlot input;
+ public final IHLInvSlotOutput outputSlot;
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ private final IHLFluidTank fluidTank = new IHLFluidTank(8000);
+ public short temperature=20;
+
+ public FluidizedBedReactorTileEntity() {
+ super();
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
+ this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 1);
+ this.input = new ApparatusProcessableInvSlot(this, "input", 3, Access.IO, 2, 64);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=side;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("fluidizedBedReactor");
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, fluidTank);
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, int amount, boolean doDrain)
+ {
+ switch(from)
+ {
+ case UP:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case NORTH:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case SOUTH:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case WEST:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case EAST:
+ return this.fluidTank.drainLightest(amount, doDrain);
+ case DOWN:
+ return this.fluidTank.drain(amount, doDrain);
+ default:
+ return this.fluidTank.drain(amount, doDrain);
+ }
+ }
+
+
+ //1.7.10 API
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "fluidizedBedReactor";
+ }
+
+ @Override
+ public int gaugeProgressScaled(int i)
+ {
+ return this.progress * i / operationLength;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new FluidizedBedReactorGui(new FluidizedBedReactorContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player)
+ {
+ this.fluidTank.sortFluidsByDensity();
+ return new FluidizedBedReactorContainer(player, this);
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer player) {}
+
+ @Override
+ public boolean canOperate()
+ {
+ UniversalRecipeOutput output = getOutput();
+ if(output!=null && this.outputSlot.canAdd(getOutput().getItemOutputs()))
+ {
+ if(output.specialConditions)
+ {
+ return this.checkSpecialConditions();
+ }
+ else
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean checkSpecialConditions()
+ {
+ ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing());
+ TileEntity te = worldObj.getTileEntity(xCoord+dir.offsetX, yCoord, zCoord+dir.offsetZ);
+ if(te instanceof CryogenicDistillerTileEntity)
+ {
+ CryogenicDistillerTileEntity cgte = (CryogenicDistillerTileEntity)te;
+ return cgte.getFacing()==this.getFacing() && cgte.canProcess();
+ }
+ return false;
+ }
+
+ public UniversalRecipeOutput getOutput()
+ {
+ return FluidizedBedReactorTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public List[] getInput()
+ {
+ for(int i=0;i<fluidTank.getNumberOfFluids();i++)
+ {
+ for(int i1=0;i1<fluidTank.getNumberOfFluids();i1++)
+ {
+ if(i!=i1)
+ {
+ List[] rInput = new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList()};
+ if(FluidizedBedReactorTileEntity.recipeManager.getOutputFor(rInput)!=null)
+ {
+ return rInput;
+ }
+ }
+ }
+ }
+ return new List[] {Arrays.asList(new FluidStack[]{fluidTank.getLigthestFluid()}), this.input.getItemStackList()};
+ }
+
+ @Override
+ public void operate()
+ {
+ UniversalRecipeInput recipeInput = FluidizedBedReactorTileEntity.recipeManager.getRecipeInput(getInput());
+ UniversalRecipeOutput output1 = getOutput();
+ this.fluidTank.drain(recipeInput.getFluidInputs(), true);
+ for (int i = 0; i < recipeInput.getItemInputs().size(); i++) {
+ this.input.consume(recipeInput.getItemInputs().get(i));
+ if (recipeInput.getItemInputs().get(i).getAmount() == 0) {
+ for (int i1 = 0; i1 < this.input.size(); i1++) {
+ ItemStack stack = this.input.get(i1);
+ if (stack != null && recipeInput.getItemInputs().get(i).matches(stack)) {
+ if (stack.stackTagCompound == null) {
+ stack.stackTagCompound = new NBTTagCompound();
+ }
+ stack.stackTagCompound.setInteger("catalyst_uses",
+ stack.stackTagCompound.getInteger("catalyst_uses") + 1);
+ if (stack.stackTagCompound.getInteger("catalyst_uses") > IHLMod.config.maxCatalystUses){
+ stack.stackTagCompound.setInteger("catalyst_uses", 0);
+ if(--stack.stackSize<=0)
+ this.input.put(i1, null);
+ }
+ }
+ }
+ }
+ }
+ if(output1.getFluidOutputs().size()>0)this.fluidTank.fill(output1.getFluidOutputs().get(0).copy(), true);
+ if(output1.getFluidOutputs().size()>1)this.fluidTank.fill(output1.getFluidOutputs().get(1).copy(), true);
+ if(!output1.getItemOutputs().isEmpty() && output1.getItemOutputs().get(0)!=null)this.outputSlot.add(output1.getItemOutputs());
+
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) {
+ if(fluidTank.getFluid()!=null && fluidTank.getFluid().containsFluid(fluidStack))
+ {
+ return this.fluidTank.drain(fluidStack, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.fluidTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[] {this.fluidTank.getInfo()};
+ }
+
+ public boolean needsFluid()
+ {
+ return this.fluidTank.getFluidAmount() <= this.fluidTank.getCapacity();
+ }
+
+ public FluidStack getFluidStackfromTank()
+ {
+ return this.fluidTank.getFluid();
+ }
+
+ public int getTankAmount()
+ {
+ return this.fluidTank.getFluidAmount();
+ }
+
+ public int gaugeLiquidScaled(int i, int index)
+ {
+ return this.fluidTank.getFluidAmount() <= 0 ? 0 : this.fluidTank.getFluidAmount(index) * i / this.fluidTank.getCapacity();
+ }
+ public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output)
+ {
+ recipeManager.addRecipe(input, output);
+ }
+
+ public int getNumberOfFluidsInTank()
+ {
+ return this.fluidTank.getNumberOfFluids();
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes()
+ {
+ return recipeManager.getRecipes();
+ }
+
+ public static void addRecipe(FluidStack fluidStackInput1, ItemStack itemStackInput, FluidStack fluidStackOutput, ItemStack itemStackOutput1)
+ {
+ if(fluidStackOutput!=null)
+ {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] {fluidStackInput1}), (new ItemStack[] {itemStackInput})), new UniversalRecipeOutput((new FluidStack[] {fluidStackOutput}), (new ItemStack[] {itemStackOutput1}),200));
+ }
+ else
+ {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] {fluidStackInput1}), (new ItemStack[] {itemStackInput})), new UniversalRecipeOutput(null, (new ItemStack[] {itemStackOutput1}),200));
+ }
+ }
+
+ public IHLFluidTank getFluidTank()
+ {
+ return this.fluidTank;
+ }
+
+ public static void addRecipe(FluidStack fluidStackInput1, ItemStack itemStackInput, FluidStack fluidStackOutput, RecipeOutputItemStack itemStackOutput1) {
+ if(fluidStackOutput!=null)
+ {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] {fluidStackInput1}), (new ItemStack[] {itemStackInput})), new UniversalRecipeOutput((new FluidStack[] {fluidStackOutput}), (new RecipeOutputItemStack[] {itemStackOutput1}),200));
+ }
+ else
+ {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] {fluidStackInput1}), (new ItemStack[] {itemStackInput})), new UniversalRecipeOutput(null, (new RecipeOutputItemStack[] {itemStackOutput1}),200));
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/FractionatorBottomModel.java b/src/main/java/ihl/processing/chemistry/FractionatorBottomModel.java
new file mode 100644
index 0000000..c395af7
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/FractionatorBottomModel.java
@@ -0,0 +1,48 @@
+// Date: 05.04.2015 16:55:22
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+
+package ihl.processing.chemistry;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class FractionatorBottomModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+
+ public FractionatorBottomModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Box03", 0, 0);
+ setTextureOffset("Base.Box04", 0, 0);
+ setTextureOffset("Base.Pipeup02", 0, 0);
+ setTextureOffset("Base.WestPipe03", 0, 0);
+ setTextureOffset("Base.WestPipe04", 0, 0);
+ setTextureOffset("Base.PipeUp05", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Box03", 2F, -7.1F, -8F, 6, 15, 16);
+ Base.addBox("Box04", -8F, 7F, -8F, 16, 1, 16);
+ Base.addTube("Pipeup02", -8F, -8F, -8F, 16, 1, 16, 0.8F, 1.0F, ForgeDirection.UP);
+ Base.addTube("WestPipe03", -7.5F, -1.5F, -1.5F, 3, 3, 3, 0.8F, 1.0F, ForgeDirection.WEST);
+ Base.addTube("WestPipe04", -8F, -2F, -2F, 1, 4, 4, 0.8F, 1.0F, ForgeDirection.WEST);
+ Base.addTube("PipeUp05", -7F, -7F, -7F, 14, 15, 14, 0.8F, 1.0F, ForgeDirection.UP);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/FractionatorBottomTileEntity.java b/src/main/java/ihl/processing/chemistry/FractionatorBottomTileEntity.java
new file mode 100644
index 0000000..3d9e95e
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/FractionatorBottomTileEntity.java
@@ -0,0 +1,352 @@
+package ihl.processing.chemistry;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import ic2.api.energy.tile.IHeatSource;
+import ic2.core.IC2;
+import ic2.core.block.TileEntityInventory;
+import ihl.recipes.IRecipeInputFluid;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import ihl.worldgen.ores.IHLFluid;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class FractionatorBottomTileEntity extends TileEntityInventory implements IFluidHandler
+{
+ private final static UniversalRecipeManager recipeManager = new UniversalRecipeManager("fractionator");
+ private static float kF = 24000F;
+ private static float fluidC = 4F;
+ private static float H = 2256F;
+ private final IHLFluidTank waterTank = new IHLFluidTank(100);
+ private final IHLFluidTank fluidTank = new IHLFluidTank(8000);
+ private int amountOfGasCondensed=0;
+ private int amountOfFluidEvaporated=0;
+ private int systemHeat=0;
+ private static final int maxSystemHeat=10000;
+ private final List<FractionatorSectionTileEntity> listOfColumnSections = new ArrayList<FractionatorSectionTileEntity>();
+ private FractionatorCoverTileEntity columnCover;
+ private RefluxCondenserTileEntity refluxCondenser;
+ private IHeatSource heatSource;
+ private int fluxRecirculationProportion=10;
+
+ public FractionatorBottomTileEntity()
+ {
+ super();
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ this.waterTank.readFromNBT(nbttagcompound.getCompoundTag("waterTank"));
+ this.amountOfGasCondensed=nbttagcompound.getInteger("amountOfGasCondensed");
+ this.systemHeat=nbttagcompound.getInteger("systemHeat");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+
+ NBTTagCompound waterTankTag = new NBTTagCompound();
+ this.waterTank.writeToNBT(waterTankTag);
+ nbttagcompound.setTag("waterTank", waterTankTag);
+
+ nbttagcompound.setInteger("amountOfGasCondensed",this.amountOfGasCondensed);
+ nbttagcompound.setInteger("systemHeat",this.systemHeat);
+
+ }
+
+ public static void addRecipe(FluidStack fluidIn, FluidStack fluidOut1, FluidStack fluidOut2)
+ {
+ recipeManager.addRecipe(new UniversalRecipeInput((new FluidStack[] {fluidIn}), null), new UniversalRecipeOutput((new FluidStack[] {fluidOut1,fluidOut2}),null,2));
+ }
+
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=(short)side && side!=0 && side!=1;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("fractionatorBottom");
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ if(!this.checkIntegrity())
+ {
+ return;
+ }
+ this.fluxRecirculationProportion=100-10000/(100+this.listOfColumnSections.size()*3);
+ ForgeDirection orientation = ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.UP);
+ if(systemHeat < maxSystemHeat && this.checkHeatSource(orientation))
+ {
+ systemHeat+=this.heatSource.requestHeat(orientation.getOpposite(), Integer.MAX_VALUE);
+ }
+ FluidStack fsCurrentInput = this.fluidTank.getFluid();
+ if(fsCurrentInput!=null && fsCurrentInput.amount>100 && systemHeat>0)
+ {
+ UniversalRecipeOutput rOutput = FractionatorBottomTileEntity.recipeManager.getOutputFor(this.fluidTank.getFluidList(),null);
+ UniversalRecipeInput rInput = FractionatorBottomTileEntity.recipeManager.getRecipeInput(this.fluidTank.getFluidList(),null);
+ if(rOutput!=null)
+ {
+ IRecipeInputFluid input = rInput.getFluidInputs().get(0);
+ int rInputAmount = input.getAmount();
+ FluidStack result1=rOutput.getFluidOutputs().get(0).copy();
+ FluidStack result2=rOutput.getFluidOutputs().get(1).copy();
+ //max heat per tick of electric heater is 100
+ int amountOfFluidToEvaporate = Math.min(fsCurrentInput.amount*result2.amount/rInputAmount,systemHeat/100);
+ systemHeat-=amountOfFluidToEvaporate*100;
+ amountOfFluidEvaporated+=amountOfFluidToEvaporate;
+ int amountOfVapours=amountOfFluidEvaporated*50;
+ FluidStack coolant = this.waterTank.getFluid();
+ if(coolant!=null && coolant.amount>0)
+ {
+ int amountOfGasToCondense = Math.min(coolant.amount*50, amountOfVapours);
+ amountOfGasCondensed += amountOfGasToCondense;
+ amountOfFluidEvaporated -= amountOfGasToCondense/50;
+ }
+ if(amountOfGasCondensed>10000)
+ {
+ int amountToProcess=amountOfGasCondensed*this.fluxRecirculationProportion/5000;//only 10% of condensate will be extracted.
+ int amount = rInputAmount * amountToProcess / result2.amount;
+ result1.amount = result1.amount* amountToProcess / result2.amount;
+ result2.amount = amountToProcess;
+ this.fluidTank.drain(input,amount, true);
+ this.fillVatResidueOutputApparatus(orientation.getOpposite(), result1, true);
+ this.fillCondensateOutputApparatus(ForgeDirection.UP, result2, true);
+ amountOfGasCondensed=0;
+ }
+ }
+ }
+ if(this.waterTank.getFluid()!=null)
+ {
+ FluidStack coolant = this.waterTank.drain(5, true);
+ this.fillHeatTransferAgentOutputApparatus(ForgeDirection.UP, coolant, true);
+ }
+ }
+
+
+ private boolean checkHeatSource(ForgeDirection orientation)
+ {
+ if(this.heatSource!=null)
+ {
+ return true;
+ }
+ else
+ {
+ TileEntity te = worldObj.getTileEntity(xCoord+orientation.offsetX, yCoord, zCoord+orientation.offsetZ);
+ if(te instanceof IHeatSource)
+ {
+ if(((IHeatSource)te).maxrequestHeatTick(orientation.getOpposite())>0)
+ {
+ this.heatSource=(IHeatSource)te;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean checkIntegrity()
+ {
+ boolean allright=true;
+ if(!this.listOfColumnSections.isEmpty() &&
+ this.columnCover!=null &&
+ !this.columnCover.isInvalid() &&
+ this.refluxCondenser!=null &&
+ !this.refluxCondenser.isInvalid())
+ {
+ Iterator<FractionatorSectionTileEntity> sectionsIterator = this.listOfColumnSections.iterator();
+ while(sectionsIterator.hasNext())
+ {
+ FractionatorSectionTileEntity section = sectionsIterator.next();
+ if(section==null || section.isInvalid())
+ {
+ allright=false;
+ }
+ }
+ }
+ else
+ {
+ allright=false;
+ }
+ if(allright)
+ {
+ return true;
+ }
+ else
+ {
+ this.listOfColumnSections.clear();
+ this.columnCover=null;
+ this.refluxCondenser=null;
+ boolean checking = true;
+ int height=0;
+ while(checking)
+ {
+ height++;
+ TileEntity te = worldObj.getTileEntity(xCoord, yCoord+height, zCoord);
+ if(te instanceof FractionatorSectionTileEntity)
+ {
+ FractionatorSectionTileEntity section = (FractionatorSectionTileEntity)te;
+ section.columnBottom=this;
+ this.listOfColumnSections.add(section);
+ }
+ else if(te instanceof FractionatorCoverTileEntity)
+ {
+ if(this.listOfColumnSections.isEmpty())
+ {
+ return false;
+ }
+ FractionatorCoverTileEntity fcte = (FractionatorCoverTileEntity)te;
+ this.columnCover=fcte;
+ ForgeDirection orientation = ForgeDirection.getOrientation(fcte.getFacing()).getRotation(ForgeDirection.DOWN);
+ te = worldObj.getTileEntity(xCoord+orientation.offsetX, yCoord+height, zCoord+orientation.offsetZ);
+ if(te instanceof RefluxCondenserTileEntity)
+ {
+ if(((RefluxCondenserTileEntity)te).getFacing()==fcte.getFacing())
+ {
+ this.refluxCondenser=(RefluxCondenserTileEntity)te;
+ this.refluxCondenser.columnBottom=this;
+ return true;
+ }
+ }
+ }
+ else
+ {
+ checking=false;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getInventoryName()
+ {
+ return "fractionator";
+ }
+
+ public void onGuiClosed(EntityPlayer entityPlayer) {}
+
+ public int fill(ForgeDirection direction, FluidStack fluidStack, boolean doFill)
+ {
+ if(direction.equals(ForgeDirection.UP))
+ {
+ return waterTank.fill(fluidStack, doFill);
+ }
+ else
+ {
+ return fluidTank.fill(fluidStack, doFill);
+ }
+ }
+
+ private int fillCondensateOutputApparatus(ForgeDirection direction,FluidStack fluidStack, boolean doFill)
+ {
+ TileEntity te = worldObj.getTileEntity(this.refluxCondenser.xCoord,this.refluxCondenser.yCoord-1,this.refluxCondenser.zCoord);
+ if(te instanceof IFluidHandler)
+ {
+ return ((IFluidHandler)te).fill(direction, fluidStack, doFill);
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+
+ private int fillVatResidueOutputApparatus(ForgeDirection orientation, FluidStack fluidStack, boolean doFill) {
+ TileEntity te = worldObj.getTileEntity(xCoord+orientation.offsetX,yCoord, zCoord+orientation.offsetZ);
+ if(te instanceof IFluidHandler)
+ {
+ return ((IFluidHandler)te).fill(orientation, fluidStack, doFill);
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ private int fillHeatTransferAgentOutputApparatus(ForgeDirection direction,FluidStack fluidStack, boolean doFill)
+ {
+ ForgeDirection orientation = ForgeDirection.getOrientation(this.refluxCondenser.getFacing()).getOpposite();
+ TileEntity te = worldObj.getTileEntity(this.refluxCondenser.xCoord+orientation.offsetX,this.refluxCondenser.yCoord,this.refluxCondenser.zCoord+orientation.offsetZ);
+ if(te instanceof IFluidHandler)
+ {
+ return ((IFluidHandler)te).fill(orientation, fluidStack, doFill);
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ @Override
+ public void setFacing(short facing1)
+ {
+ super.setFacing((short) Math.max(facing1, 2));
+ }
+
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[]{this.fluidTank.getInfo(), this.waterTank.getInfo()};
+ }
+
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
+ return this.fluidTank.drain(resource, doDrain);
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
+ return this.fluidTank.drain(maxDrain, doDrain);
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection from, Fluid fluid) {
+ return true;
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection from, Fluid fluid) {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/FractionatorCoverModel.java b/src/main/java/ihl/processing/chemistry/FractionatorCoverModel.java
new file mode 100644
index 0000000..451d73c
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/FractionatorCoverModel.java
@@ -0,0 +1,52 @@
+// Date: 05.04.2015 1:01:48
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+package ihl.processing.chemistry;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class FractionatorCoverModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+
+ public FractionatorCoverModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.PipeUp03", 0, 0);
+ setTextureOffset("Base.ConeUp14to10", 0, 0);
+ setTextureOffset("Base.PipeUp", 0, 0);
+ setTextureOffset("Base.KneeUPWEST", 0, 0);
+ setTextureOffset("Base.WestPipe03", 0, 0);
+ setTextureOffset("Base.WestPipe04", 0, 0);
+ setTextureOffset("Base.ConeUp10To3", 0, 0);
+ setTextureOffset("Base.WestPipe02", 0, 0);
+ setTextureOffset("Base.WestPipe01", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addTube("PipeUp03", -8F, 7F, -8F, 16, 1, 16, .8F, 1F, ForgeDirection.UP);
+ Base.addTube("ConeUp14to10", -7F, 2F, -7F, 14, 5, 14, .8F, 0.71F, ForgeDirection.DOWN);
+ Base.addTube("PipeUp", -1.5F, -2.5F, -1.5F, 3, 3, 3, .8F, 1F, ForgeDirection.UP);
+ Base.addKnee("KneeUPWEST", -3F, -8.5F, -3F, 6, 6, 6, .8F, 1F, ForgeDirection.DOWN, ForgeDirection.WEST);
+ Base.addTube("WestPipe03", -7F, -7F, -1.5F, 4, 3, 3, .8F, 1F, ForgeDirection.WEST);
+ Base.addTube("WestPipe04", -8F, -7.5F, -2F, 1, 4, 4, .6F, 1F, ForgeDirection.WEST);
+ Base.addTube("ConeUp10To3", -5F, 0F, -5F, 10, 2, 10, .8F, 0.3F, ForgeDirection.DOWN);
+ Base.addTube("WestPipe02", -8F, 3F, -2F, 1, 4, 4, .6F, 1F, ForgeDirection.WEST);
+ Base.addTube("WestPipe01", -7F, 3.5F, -1.5F, 3, 3, 3, .8F, 1F, ForgeDirection.WEST);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/FractionatorCoverTileEntity.java b/src/main/java/ihl/processing/chemistry/FractionatorCoverTileEntity.java
new file mode 100644
index 0000000..048f953
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/FractionatorCoverTileEntity.java
@@ -0,0 +1,104 @@
+package ihl.processing.chemistry;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ic2.api.network.INetworkDataProvider;
+import ic2.api.tile.IWrenchable;
+import ic2.core.IC2;
+import ihl.utils.IHLUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+
+public class FractionatorCoverTileEntity extends TileEntity implements IWrenchable, INetworkDataProvider{
+
+ private short facing=2;
+ private short lastFacing=2;
+ public FractionatorBottomTileEntity columnBottom;
+
+ public FractionatorCoverTileEntity()
+ {
+ super();
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = new ArrayList<String>();
+ fields.add("facing");
+ return fields;
+ }
+
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+ if(lastFacing!=facing)
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ lastFacing=facing;
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=side;
+ }
+
+
+ @Override
+ public short getFacing() {
+ return this.facing;
+ }
+
+
+ @Override
+ public void setFacing(short facing1)
+ {
+ facing=(short) Math.max(2,facing1);
+ if(IC2.platform.isSimulating())
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
+ return true;
+ }
+
+
+ @Override
+ public float getWrenchDropRate() {
+ return 1F;
+ }
+
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("fractionatorCover");
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ facing=nbttagcompound.getShort("facing");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setShort("facing", facing);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/FractionatorSectionModel.java b/src/main/java/ihl/processing/chemistry/FractionatorSectionModel.java
new file mode 100644
index 0000000..2a20e7b
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/FractionatorSectionModel.java
@@ -0,0 +1,47 @@
+// Date: 05.04.2015 16:59:49
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+package ihl.processing.chemistry;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+
+public class FractionatorSectionModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+
+ public FractionatorSectionModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.PipeUp03", 0, 0);
+ setTextureOffset("Base.Pipeup02", 0, 0);
+ setTextureOffset("Base.WestPipe03", 0, 0);
+ setTextureOffset("Base.WestPipe04", 0, 0);
+ setTextureOffset("Base.PipeUp05", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addTube("PipeUp03", -8F, 7F, -8F, 16, 1, 16, 0.8F, 1.0F, ForgeDirection.UP);
+ Base.addTube("Pipeup02", -8F, -8F, -8F, 16, 1, 16, 0.8F, 1.0F, ForgeDirection.UP);
+ Base.addTube("WestPipe03", 4.5F, -1.5F, -1.5F, 3, 3, 3, 0.8F, 1.0F, ForgeDirection.WEST);
+ Base.addTube("WestPipe04", 7F, -2F, -2F, 1, 4, 4, 0.8F, 1.0F, ForgeDirection.WEST);
+ Base.addTube("PipeUp05", -7F, -7F, -7F, 14, 14, 14, 0.8F, 1.0F, ForgeDirection.UP);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/FractionatorSectionTileEntity.java b/src/main/java/ihl/processing/chemistry/FractionatorSectionTileEntity.java
new file mode 100644
index 0000000..e71c453
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/FractionatorSectionTileEntity.java
@@ -0,0 +1,148 @@
+package ihl.processing.chemistry;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ic2.api.network.INetworkDataProvider;
+import ic2.api.tile.IWrenchable;
+import ic2.core.IC2;
+import ihl.utils.IHLUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class FractionatorSectionTileEntity extends TileEntity implements IWrenchable, INetworkDataProvider, IFluidHandler{
+
+ private short facing=2;
+ private short lastFacing=2;
+ public FractionatorBottomTileEntity columnBottom;
+
+ public FractionatorSectionTileEntity()
+ {
+ super();
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = new ArrayList<String>();
+ fields.add("facing");
+ return fields;
+ }
+
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+ if(lastFacing!=facing)
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ lastFacing=facing;
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=side;
+ }
+
+
+ @Override
+ public short getFacing() {
+ return this.facing;
+ }
+
+
+ @Override
+ public void setFacing(short facing1)
+ {
+ facing=(short) Math.max(2,facing1);
+ if(IC2.platform.isSimulating())
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
+ return true;
+ }
+
+
+ @Override
+ public float getWrenchDropRate() {
+ return 1F;
+ }
+
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("fractionatorSection");
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ facing=nbttagcompound.getShort("facing");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setShort("facing", facing);
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return false;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.UP).equals(direction);
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return null;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, int arg1, boolean arg2) {
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection direction, FluidStack fluidStack, boolean doFill) {
+ if(fluidStack!=null && fluidStack.getFluid()!=null && this.canFill(direction, fluidStack.getFluid()) && columnBottom!=null)
+ {
+ return columnBottom.fill(direction, fluidStack, doFill);
+ }
+ return 0;
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0)
+ {
+ if(columnBottom!=null)
+ return columnBottom.getTankInfo(arg0);
+ else
+ return new FluidTankInfo[] {new FluidTankInfo(null, 8000)};
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpContainer.java b/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpContainer.java
new file mode 100644
index 0000000..b283a48
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpContainer.java
@@ -0,0 +1,76 @@
+package ihl.processing.chemistry;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class GaedesMercuryRotaryPumpContainer extends ContainerBase<GaedesMercuryRotaryPumpTileEntity> {
+
+ protected GaedesMercuryRotaryPumpTileEntity tileEntity;
+ private final static int height=166;
+ public short lastEnergy = -1;
+ public short lastProgress = -1;
+
+ public GaedesMercuryRotaryPumpContainer(EntityPlayer entityPlayer, GaedesMercuryRotaryPumpTileEntity tileEntity1){
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ int col;
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 61, 36));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+
+ if (this.tileEntity.progress != this.lastProgress)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+ if ((short) this.tileEntity.energy != this.lastEnergy)
+ {
+ icrafting.sendProgressBarUpdate(this, 2, (short) this.tileEntity.energy);
+ }
+ }
+
+ this.lastProgress = this.tileEntity.progress;
+ this.lastEnergy = (short) this.tileEntity.energy;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+
+ switch (index)
+ {
+ case 0:
+ this.tileEntity.progress=(short) value;
+ break;
+ case 2:
+ this.tileEntity.energy=value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpGui.java b/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpGui.java
new file mode 100644
index 0000000..28c9edc
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpGui.java
@@ -0,0 +1,60 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+public class GaedesMercuryRotaryPumpGui extends GuiContainer {
+
+ private GaedesMercuryRotaryPumpContainer container;
+ protected static final ResourceLocation tex = new ResourceLocation("ihl", "textures/gui/GUIGaedesMercuryRotaryPump.png");
+
+ public GaedesMercuryRotaryPumpGui(GaedesMercuryRotaryPumpContainer latheContainer) {
+ super(latheContainer);
+ container = latheContainer;
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(51, 37 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27),27);
+ this.drawTexturedModalRect(17, 30, getFrameX(i1), getFrameY(i1),24,24);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ private int getFrameY(int number)
+ {
+ return (number % 10) * 24 + 14;
+ }
+
+ private int getFrameX(int number)
+ {
+ return (number / 10) * 24 + 176;
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpModel.java b/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpModel.java
new file mode 100644
index 0000000..607d26a
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpModel.java
@@ -0,0 +1,64 @@
+package ihl.processing.chemistry;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+// Date: 17.03.2015 21:30:34
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+
+public class GaedesMercuryRotaryPumpModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+
+ public GaedesMercuryRotaryPumpModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.PipeN1", 0, 0);
+ setTextureOffset("Base.PipeU3", 0, 0);
+ setTextureOffset("Base.Shape3", 0, 0);
+ setTextureOffset("Base.PipeN2", 0, 0);
+ setTextureOffset("Base.Shape5", 0, 0);
+ setTextureOffset("Base.Shape6", 0, 0);
+ setTextureOffset("Base.Shape7", 0, 0);
+ setTextureOffset("Base.PipeU4", 0, 0);
+ setTextureOffset("Base.Shape1", 0, 0);
+ setTextureOffset("Base.PipeW5", 0, 0);
+ setTextureOffset("Base.Shape2", 0, 0);
+ setTextureOffset("Base.Shape4", 0, 0);
+ setTextureOffset("Base.Shape8", 0, 0);
+ setTextureOffset("Base.PipeW8", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addTube("PipeN1", -5F, -5F, -6F, 10, 10, 10,0F,1F,ForgeDirection.NORTH);
+ Base.addTube("PipeU3", -0.5F, -2.5F, -8F, 1, 2, 1,0.1F,1F,ForgeDirection.UP);
+ Base.addBox("Shape3", -0.5F, -0.5F, -8F, 1, 1, 2);
+ Base.addTube("PipeN2", -3F, -2F, 4F, 6, 6, 4,0F,1F,ForgeDirection.NORTH);
+ Base.addBox("Shape5", -7F, 7F, -6F, 14, 1, 14);
+ Base.addBox("Shape6", 2F, 1F, -5F, 1, 6, 12);
+ Base.addBox("Shape7", -3F, 1F, -5F, 1, 6, 12);
+ Base.addTube("PipeU4", 0F, -8F, -5F, 1, 3, 1,0.1F,1F,ForgeDirection.UP);
+ Base.addBox("Shape1", 0F, -7F, -5F, 1, 1, 1);
+ Base.addTube("PipeW5", -1F, -7F, -5F, 8, 1, 1,0.1F,1F,ForgeDirection.WEST);
+ Base.addBox("Shape2", 4F, -8F, -5F, 1, 2, 1);
+ Base.addBox("Shape4", 4F, -8F, -1F, 1, 8, 1);
+ Base.addBox("Shape8", -5F, -8F, -1F, 1, 8, 1);
+ Base.addTube("PipeW8", -4F, -8F, -1F, 8, 1, 1,0.1F,1F,ForgeDirection.WEST);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpTileEntity.java b/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpTileEntity.java
new file mode 100644
index 0000000..186b606
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/GaedesMercuryRotaryPumpTileEntity.java
@@ -0,0 +1,83 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ihl.interfaces.IWorkspaceElement;
+import ihl.processing.metallurgy.BasicElectricMotorTileEntity;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+public class GaedesMercuryRotaryPumpTileEntity extends BasicElectricMotorTileEntity implements IWorkspaceElement{
+
+ public boolean ready=false;
+
+ public GaedesMercuryRotaryPumpTileEntity()
+ {
+ }
+
+ @Override
+ public void operate()
+ {
+ ready=true;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
+ {
+ return IHLUtils.getThisModItemStack("gaedesMercuryRotaryPump");
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public List[] getInput()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean canOperate()
+ {
+ return !ready;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new GaedesMercuryRotaryPumpGui(new GaedesMercuryRotaryPumpContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new GaedesMercuryRotaryPumpContainer(player, this);
+ }
+
+ @Override
+ public boolean canBeUsed()
+ {
+ return ready;
+ }
+
+ @Override
+ public void use()
+ {
+ ready=false;
+ }
+
+ @Override
+ public boolean getIsInvalid()
+ {
+ return this.isInvalid();
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/LabElectrolyzerContainer.java b/src/main/java/ihl/processing/chemistry/LabElectrolyzerContainer.java
new file mode 100644
index 0000000..1be5e01
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/LabElectrolyzerContainer.java
@@ -0,0 +1,73 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraftforge.fluids.FluidStack;
+
+public class LabElectrolyzerContainer extends BasicElectricMotorContainer<LabElectrolyzerTileEntity> {
+
+ protected LabElectrolyzerTileEntity tileEntity;
+ public short lastProgress = -1;
+ public short lastTemperature = -1;
+ public short lastEnergy = -1;
+ public int lastFluidAmount = -1;
+ public int lastNumberOfFluids = -1;
+ public int lastFluidAmount2 = -1;
+ public int lastNumberOfFluids2 = -1;
+ public int lastFluidAmount3 = -1;
+ public int lastNumberOfFluids3 = -1;
+ public List<FluidStack> fluidTankFluidList;
+ public List<FluidStack> fluidTankFluidList2;
+ public List<FluidStack> fluidTankFluidList3;
+
+ public LabElectrolyzerContainer(EntityPlayer entityPlayer, LabElectrolyzerTileEntity tileEntity1) {
+ super(entityPlayer, tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList = this.tileEntity.getFluidTank().getFluidList();
+ fluidTankFluidList2 = this.tileEntity.fluidTankAnodeOutput.getFluidList();
+ fluidTankFluidList3 = this.tileEntity.fluidTankCathodeOutput.getFluidList();
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 63, 47));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlotAnodeOutput, 0, 109, 47));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlotCathodeOutput, 0, 29, 47));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 63, 11));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 29, 11));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 1, 63, 29));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 2, 109, 11));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 63, 65));
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (this.tileEntity.getTankAmount() != this.lastFluidAmount
+ || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
+
+ if (this.tileEntity.fluidTankAnodeOutput.getFluidAmount() != this.lastFluidAmount2
+ || this.tileEntity.fluidTankAnodeOutput.getNumberOfFluids() != this.lastNumberOfFluids2) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList2");
+ }
+
+ if (this.tileEntity.fluidTankCathodeOutput.getFluidAmount() != this.lastFluidAmount3
+ || this.tileEntity.fluidTankCathodeOutput.getNumberOfFluids() != this.lastNumberOfFluids3) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList3");
+ }
+
+ this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
+ this.lastFluidAmount = this.tileEntity.getTankAmount();
+ this.lastNumberOfFluids2 = this.tileEntity.fluidTankAnodeOutput.getNumberOfFluids();
+ this.lastFluidAmount2 = this.tileEntity.fluidTankAnodeOutput.getFluidAmount();
+ this.lastNumberOfFluids3 = this.tileEntity.fluidTankCathodeOutput.getNumberOfFluids();
+ this.lastFluidAmount3 = this.tileEntity.fluidTankCathodeOutput.getFluidAmount();
+
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/LabElectrolyzerGui.java b/src/main/java/ihl/processing/chemistry/LabElectrolyzerGui.java
new file mode 100644
index 0000000..3eb14a3
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/LabElectrolyzerGui.java
@@ -0,0 +1,74 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+@SideOnly(Side.CLIENT)
+public class LabElectrolyzerGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl",
+ "textures/gui/GUILabElectrolyzer.png");
+ private LabElectrolyzerContainer container;
+
+ public LabElectrolyzerGui(LabElectrolyzerContainer container1) {
+ // the container is instanciated and passed to the superclass for
+ // handling
+ super(container1);
+ this.container = container1;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12), 12);
+ this.drawTexturedModalRect(12, 16 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27), 27);
+ this.drawTexturedModalRect(81, 31, getFrameX(i1), getFrameY(i1), 24, 24);
+ }
+ if (this.container.tileEntity.getTankAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 83, 15, 104, 81, zLevel,
+ par1, par2, xOffset, yOffset);
+ }
+ if (this.container.tileEntity.fluidTankCathodeOutput.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankCathodeOutput, 48, 24, 59, 81,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ if (this.container.tileEntity.fluidTankAnodeOutput.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.fluidTankAnodeOutput, 128, 24, 139, 81,
+ zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ // draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ private int getFrameY(int number) {
+ return (number % 10) * 24 + 14;
+ }
+
+ private int getFrameX(int number) {
+ return (number / 10) * 24 + 176;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/LabElectrolyzerTileEntity.java b/src/main/java/ihl/processing/chemistry/LabElectrolyzerTileEntity.java
new file mode 100644
index 0000000..19348b6
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/LabElectrolyzerTileEntity.java
@@ -0,0 +1,272 @@
+package ihl.processing.chemistry;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.processing.metallurgy.BasicElectricMotorTileEntity;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class LabElectrolyzerTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler {
+ private final static UniversalRecipeManager recipeManager = new UniversalRecipeManager("labelectrolyzer");
+ public final IHLInvSlotOutput outputSlot;
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlotAnodeOutput;
+ public final InvSlotConsumableLiquidIHL fillInputSlotCathodeOutput;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ private final IHLFluidTank fluidTank = new IHLFluidTank(2000);
+ public final IHLFluidTank fluidTankAnodeOutput = new IHLFluidTank(8000);
+ public final IHLFluidTank fluidTankCathodeOutput = new IHLFluidTank(8000);
+ public short temperature = 20;
+
+ public LabElectrolyzerTileEntity() {
+ super();
+ this.energyConsume *= 10;
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 2);
+ this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.fillInputSlotAnodeOutput = new InvSlotConsumableLiquidIHL(this, "fillInputAnodeOutput", -1,
+ InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.fillInputSlotCathodeOutput = new InvSlotConsumableLiquidIHL(this, "fillInputCathodeOutput", -1,
+ InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 3);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ this.fluidTankAnodeOutput.readFromNBT(nbttagcompound.getCompoundTag("fluidTankAnodeOutput"));
+ this.fluidTankCathodeOutput.readFromNBT(nbttagcompound.getCompoundTag("fluidTankCathodeOutput"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+
+ NBTTagCompound fluidTankAnodeTag = new NBTTagCompound();
+ this.fluidTankAnodeOutput.writeToNBT(fluidTankAnodeTag);
+ nbttagcompound.setTag("fluidTankAnodeOutput", fluidTankAnodeTag);
+
+ NBTTagCompound fluidTankCathodeTag = new NBTTagCompound();
+ this.fluidTankCathodeOutput.writeToNBT(fluidTankCathodeTag);
+ nbttagcompound.setTag("fluidTankCathodeOutput", fluidTankCathodeTag);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing() != side;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("labElectrolyzer");
+ }
+
+ @Override
+ public boolean enableUpdateEntity() {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void updateEntityServer() {
+ super.updateEntityServer();
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, fluidTank);
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlotAnodeOutput, null, emptyFluidItemsSlot, fluidTankAnodeOutput);
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlotCathodeOutput, null, emptyFluidItemsSlot,
+ fluidTankCathodeOutput);
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection direction, int amount, boolean doDrain) {
+ if (this.canDrain(direction, null)) {
+ if (direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.UP))) {
+ return this.fluidTankAnodeOutput.drain(amount, doDrain);
+ }
+ if (direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.DOWN))) {
+ return this.fluidTankCathodeOutput.drain(amount, doDrain);
+ }
+ return this.fluidTank.drain(amount, doDrain);
+ }
+ return null;
+ }
+
+ // 1.7.10 API
+ @Override
+ public boolean canDrain(ForgeDirection direction, Fluid arg1) {
+ return direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.UP))
+ || direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.DOWN))
+ || direction.equals(ForgeDirection.DOWN);
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return direction.equals(ForgeDirection.getOrientation(this.getFacing()).getOpposite());
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "labElectrolizer";
+ }
+
+ @Override
+ public int gaugeProgressScaled(int i) {
+ return this.progress * i / operationLength;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new LabElectrolyzerGui(new LabElectrolyzerContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ this.fluidTank.sortFluidsByDensity();
+ return new LabElectrolyzerContainer(player, this);
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer player) {
+ }
+
+ @Override
+ public boolean canOperate() {
+ UniversalRecipeOutput output = getOutput();
+ if (output != null) {
+ if (getOutput().getItemOutputs() != null && !getOutput().getItemOutputs().isEmpty()
+ && getOutput().getItemOutputs().get(0) != null) {
+ return this.outputSlot.canAdd(getOutput().getItemOutputs());
+ } else {
+ return this.fluidTankAnodeOutput.getFluidAmount() < this.fluidTankAnodeOutput.getCapacity()
+ && this.fluidTankAnodeOutput.getFluidAmount() < this.fluidTankCathodeOutput.getCapacity();
+ }
+ }
+ return false;
+ }
+
+ public UniversalRecipeOutput getOutput() {
+ return LabElectrolyzerTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public List[] getInput() {
+ return new List[] { Arrays.asList(new FluidStack[] { fluidTank.getFluid() }), null };
+ }
+
+ @Override
+ public void operate() {
+ UniversalRecipeInput recipeInput = LabElectrolyzerTileEntity.recipeManager.getRecipeInput(getInput());
+ UniversalRecipeOutput output1 = getOutput();
+ this.fluidTank.drain(recipeInput.getFluidInputs().get(0), true);
+ if (output1.getFluidOutputs().size() > 0)
+ this.fluidTankAnodeOutput.fill(output1.getFluidOutputs().get(0).copy(), true);
+ if (output1.getFluidOutputs().size() > 1)
+ this.fluidTankCathodeOutput.fill(output1.getFluidOutputs().get(1).copy(), true);
+ if (!output1.getItemOutputs().isEmpty() && output1.getItemOutputs().get(0) != null)
+ this.outputSlot.add(output1.getItemOutputs());
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection direction, FluidStack fluidStack, boolean doDrain) {
+ if (this.fluidTankAnodeOutput.getFluid().containsFluid(fluidStack)) {
+ return this.fluidTankAnodeOutput.drain(fluidStack.amount, doDrain);
+ } else if (this.fluidTankCathodeOutput.getFluid().containsFluid(fluidStack)) {
+ return this.fluidTankCathodeOutput.drain(fluidStack.amount, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.fluidTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection direction) {
+ if (direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.UP))) {
+ return new FluidTankInfo[] { this.fluidTankAnodeOutput.getInfo() };
+ }
+ if (direction.equals(ForgeDirection.getOrientation(this.getFacing()).getRotation(ForgeDirection.DOWN))) {
+ return new FluidTankInfo[] { this.fluidTankCathodeOutput.getInfo() };
+ }
+ return new FluidTankInfo[] { this.fluidTank.getInfo() };
+
+ }
+
+ public boolean needsFluid() {
+ return this.fluidTank.getFluidAmount() <= this.fluidTank.getCapacity();
+ }
+
+ public FluidStack getFluidStackfromTank() {
+ return this.fluidTank.getFluid();
+ }
+
+ public int getTankAmount() {
+ return this.fluidTank.getFluidAmount();
+ }
+
+ public int gaugeLiquidScaled(int i, int index) {
+ return this.fluidTank.getFluidAmount() <= 0 ? 0
+ : this.fluidTank.getFluidAmount(index) * i / this.fluidTank.getCapacity();
+ }
+
+ public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output) {
+ recipeManager.addRecipe(input, output);
+ }
+
+ public int getNumberOfFluidsInTank() {
+ return this.fluidTank.getNumberOfFluids();
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ public static void addRecipe(FluidStack fluidStackInput1, FluidStack fluidStackOutputAnode,
+ FluidStack fluidStackOutputCathode, ItemStack itemStackOutput1) {
+ if (itemStackOutput1 != null) {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] { fluidStackInput1 }), null),
+ new UniversalRecipeOutput((new FluidStack[] { fluidStackOutputAnode, fluidStackOutputCathode }),
+ (new ItemStack[] { itemStackOutput1 }), 200));
+ } else {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] { fluidStackInput1 }), null),
+ new UniversalRecipeOutput((new FluidStack[] { fluidStackOutputAnode, fluidStackOutputCathode }),
+ null, 200));
+ }
+ }
+
+ public IHLFluidTank getFluidTank() {
+ return this.fluidTank;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/LeadOvenContainer.java b/src/main/java/ihl/processing/chemistry/LeadOvenContainer.java
new file mode 100644
index 0000000..2f0ff8a
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/LeadOvenContainer.java
@@ -0,0 +1,95 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraftforge.fluids.FluidStack;
+
+public class LeadOvenContainer extends ContainerBase<LeadOvenTileEntity> {
+
+ protected LeadOvenTileEntity tileEntity;
+ public int lastInputFluidAmount = -1;
+ public int lastOutputFluidAmount = -1;
+ public int lastFuel = -1;
+ public short lastProgress = -1;
+ private final static int height = 166;
+ public List<FluidStack> inputTankFluidList;
+ public List<FluidStack> outputTankFluidList;
+
+ public LeadOvenContainer(EntityPlayer entityPlayer, LeadOvenTileEntity tileEntity1) {
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ inputTankFluidList = this.tileEntity.inputTank.getFluidList();
+ outputTankFluidList = this.tileEntity.outputTank.getFluidList();
+ int col;
+ for (col = 0; col < 3; ++col) {
+ for (int col1 = 0; col1 < 9; ++col1) {
+ this.addSlotToContainer(
+ new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+ for (col = 0; col < 9; ++col) {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fuelSlot, 0, 56, 53));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputSlot, 0, 47, 17));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputSlot, 1, 65, 17));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 112, 35));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 9, 53));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 9, 17));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 9, 35));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot2, 0, 150, 53));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot2, 0, 150, 17));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 1, 150, 35));
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+ if (this.tileEntity.inputTank.getFluidAmount() != this.lastInputFluidAmount) {
+ IC2.network.get().sendContainerField(this, "inputTankFluidList");
+ }
+ if (this.tileEntity.outputTank.getFluidAmount() != this.lastOutputFluidAmount) {
+ IC2.network.get().sendContainerField(this, "outputTankFluidList");
+ }
+
+ if (this.tileEntity.fuel != this.lastFuel) {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.fuel);
+ }
+
+ if (this.tileEntity.progress != this.lastProgress) {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.progress);
+ }
+ }
+ this.lastFuel = this.tileEntity.fuel;
+ this.lastProgress = this.tileEntity.progress;
+ this.lastInputFluidAmount = this.tileEntity.inputTank.getFluidAmount();
+ this.lastOutputFluidAmount = this.tileEntity.outputTank.getFluidAmount();
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value) {
+ super.updateProgressBar(index, value);
+
+ switch (index) {
+ case 0:
+ this.tileEntity.fuel = value;
+ break;
+ case 1:
+ this.tileEntity.progress = (short) value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/LeadOvenGui.java b/src/main/java/ihl/processing/chemistry/LeadOvenGui.java
new file mode 100644
index 0000000..72fb107
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/LeadOvenGui.java
@@ -0,0 +1,55 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+@SideOnly(Side.CLIENT)
+public class LeadOvenGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUILeadOven.png");
+ private LeadOvenContainer container;
+
+ public LeadOvenGui(LeadOvenContainer container1) {
+ // the container is instanciated and passed to the superclass for
+ // handling
+ super(container1);
+ this.container = container1;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ if (this.container.tileEntity.inputTank.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.inputTank, 30, 19, 42, 66, zLevel,
+ par1, par2, x, y);
+ }
+ if (this.container.tileEntity.outputTank.getFluidAmount() > 0) {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.outputTank, 133, 19, 145, 66, zLevel,
+ par1, par2, x, y);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ // draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ int i1;
+ if (this.container.tileEntity.fuel > 0) {
+ i1 = this.container.tileEntity.gaugeFuelScaled(12);
+ this.drawTexturedModalRect(x + 56, y + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
+ }
+ i1 = this.container.tileEntity.gaugeProgressScaled(24);
+ this.drawTexturedModalRect(x + 79, y + 34, 176, 14, i1 + 1, 16);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/LeadOvenTileEntity.java b/src/main/java/ihl/processing/chemistry/LeadOvenTileEntity.java
new file mode 100644
index 0000000..95636ad
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/LeadOvenTileEntity.java
@@ -0,0 +1,286 @@
+package ihl.processing.chemistry;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.recipe.IRecipeInput;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlot.Access;
+import ic2.core.block.invslot.InvSlotConsumableFuel;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.recipes.RecipeOutputItemStack;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class LeadOvenTileEntity extends TileEntityInventory implements IHasGui, IFluidHandler {
+ public final InvSlotConsumableFuel fuelSlot;
+ public final ApparatusProcessableInvSlot inputSlot;
+ public final IHLInvSlotOutput outputSlot;
+ public final IHLFluidTank inputTank = new IHLFluidTank(1000);
+ public final IHLFluidTank outputTank = new IHLFluidTank(1000);
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ public final InvSlotConsumableLiquidIHL drainInputSlot2;
+ public final InvSlotConsumableLiquidIHL fillInputSlot2;
+ public short progress = 0;
+ public final short maxProgress = 160;
+ public int fuel = 0;
+ public int maxFuel = 0;
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("chemicaloven");
+
+ public LeadOvenTileEntity() {
+ super();
+ this.fuelSlot = new InvSlotConsumableFuel(this, "fuel", 1, 1, true);
+ this.inputSlot = new ApparatusProcessableInvSlot(this, "input", 2, Access.IO, 2, 64);
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
+ this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.drainInputSlot2 = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot2 = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1,
+ InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 2);
+ }
+
+ public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output) {
+ recipeManager.addRecipe(input, output);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.fuel = nbttagcompound.getInteger("fuel");
+ this.maxFuel = nbttagcompound.getInteger("maxFuel");
+ this.progress = nbttagcompound.getShort("progress");
+ this.inputTank.readFromNBT(nbttagcompound.getCompoundTag("inputTank"));
+ this.outputTank.readFromNBT(nbttagcompound.getCompoundTag("outputTank"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setInteger("fuel", this.fuel);
+ nbttagcompound.setInteger("maxFuel", this.maxFuel);
+ nbttagcompound.setShort("progress", this.progress);
+ NBTTagCompound inputTankTag = new NBTTagCompound();
+ this.inputTank.writeToNBT(inputTankTag);
+ nbttagcompound.setTag("inputTank", inputTankTag);
+ NBTTagCompound outputTankTag = new NBTTagCompound();
+ this.outputTank.writeToNBT(outputTankTag);
+ nbttagcompound.setTag("outputTank", outputTankTag);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing() != (short) side && side != 0 && side != 1;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("leadOven");
+ }
+
+ public int gaugeProgressScaled(int i) {
+ return this.progress * i / maxProgress;
+ }
+
+ public int gaugeFuelScaled(int i) {
+ if (this.maxFuel == 0) {
+ this.maxFuel = this.fuel;
+
+ if (this.maxFuel == 0) {
+ this.maxFuel = 160;
+ }
+ }
+
+ return this.fuel * i / this.maxFuel;
+ }
+
+ public boolean enableUpdateEntity() {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void updateEntityServer() {
+ super.updateEntityServer();
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, inputTank);
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot2, drainInputSlot2, emptyFluidItemsSlot, outputTank);
+ if (this.fuel <= 0 && this.canOperate()) {
+ this.fuel = this.maxFuel = this.fuelSlot.consumeFuel();
+ }
+
+ if (this.isBurning() && this.canOperate()) {
+ ++this.progress;
+
+ if (this.progress >= maxProgress) {
+ this.progress = 0;
+ this.operate();
+ }
+ } else {
+ this.progress = 0;
+ }
+
+ if (this.fuel > 0) {
+ --this.fuel;
+ }
+
+ if (this.getActive() != this.isBurning()) {
+ this.setActive(this.isBurning());
+ }
+ }
+
+ public boolean isBurning() {
+ return this.fuel > 0;
+ }
+
+ public boolean canOperate() {
+ return this.getOutput() != null;
+ }
+
+ /**
+ * Returns the name of the inventory
+ */
+ @Override
+ public String getInventoryName() {
+ return "goldOven";
+ }
+
+ @Override
+ public ContainerBase<LeadOvenTileEntity> getGuiContainer(EntityPlayer entityPlayer) {
+ return new LeadOvenContainer(entityPlayer, this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) {
+ return new LeadOvenGui(new LeadOvenContainer(entityPlayer, this));
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer entityPlayer) {
+ }
+
+ public UniversalRecipeOutput getOutput() {
+ return LeadOvenTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List[] getInput() {
+ if (this.inputSlot.get(1) != null) {
+ return new List[] { this.inputTank.getFluidList(),
+ Arrays.asList(new ItemStack[] { this.inputSlot.get(0), this.inputSlot.get(1) }) };
+ }
+ return new List[] { this.inputTank.getFluidList(), Arrays.asList(new ItemStack[] { this.inputSlot.get() }) };
+ }
+
+ public void operate() {
+ UniversalRecipeInput rinput = LeadOvenTileEntity.recipeManager.getRecipeInput(getInput());
+ List<IRecipeInput> rinputItems = rinput.getItemInputs();
+ UniversalRecipeOutput routput = LeadOvenTileEntity.recipeManager.getOutputFor(getInput());
+ List<FluidStack> output2 = routput.getFluidOutputs();
+ if (!output2.isEmpty()) {
+ this.outputTank.fill(output2.get(0), true);
+ }
+ this.inputTank.drain(rinput.getFluidInputs(), true);
+ List<RecipeOutputItemStack> itemOutputs = routput.getItemOutputs();
+ if (itemOutputs != null && !itemOutputs.isEmpty()) {
+ this.outputSlot.add(itemOutputs);
+ }
+ for (int i = 0; i < rinputItems.size(); i++) {
+ this.inputSlot.consume(rinputItems.get(i));
+ }
+
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, int amount, boolean doDrain) {
+ switch (from) {
+ case UP:
+ return this.outputTank.drainLightest(amount, doDrain);
+ case NORTH:
+ return this.outputTank.drainLightest(amount, doDrain);
+ case SOUTH:
+ return this.outputTank.drainLightest(amount, doDrain);
+ case WEST:
+ return this.outputTank.drainLightest(amount, doDrain);
+ case EAST:
+ return this.outputTank.drainLightest(amount, doDrain);
+ case DOWN:
+ return this.outputTank.drain(amount, doDrain);
+ default:
+ return this.outputTank.drain(amount, doDrain);
+ }
+ }
+
+ // 1.7.10 API
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return direction.equals(ForgeDirection.getOrientation(this.getFacing()).getOpposite());
+ }
+
+ public static void addRecipe(UniversalRecipeInput input, FluidStack fluidStackWithSize) {
+ recipeManager.addRecipe(input, new UniversalRecipeOutput((new FluidStack[] { fluidStackWithSize }), null, 20));
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ public static void addRecipe(IRecipeInput recipeInputOreDict, FluidStack fluidStackOutput, ItemStack output) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { recipeInputOreDict })),
+ new UniversalRecipeOutput((new FluidStack[] { fluidStackOutput }), (new ItemStack[] { output }), 20));
+ }
+
+ public static void addRecipe(IRecipeInput input, ItemStack output) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { input })),
+ new UniversalRecipeOutput(null, (new ItemStack[] { output }), 20));
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) {
+ if (outputTank.getFluid() != null && outputTank.getFluid().containsFluid(fluidStack)) {
+ return this.outputTank.drain(fluidStack, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.inputTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[] { this.inputTank.getInfo() };
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/LoomContainer.java b/src/main/java/ihl/processing/chemistry/LoomContainer.java
new file mode 100644
index 0000000..2d480ef
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/LoomContainer.java
@@ -0,0 +1,66 @@
+package ihl.processing.chemistry;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class LoomContainer extends ContainerBase<LoomTileEntity> {
+
+ public LoomTileEntity tileEntity;
+ public int lastProgress = -1;
+ private final static int height=166;
+
+ public LoomContainer(EntityPlayer entityPlayer,
+ LoomTileEntity lathePart1TileEntity) {
+ super(lathePart1TileEntity);
+ tileEntity=lathePart1TileEntity;
+ int col;
+
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.input, 0, 8, 44));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.output, 0, 127, 44));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ if (this.tileEntity.progress != this.lastProgress)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+ }
+ this.lastProgress = this.tileEntity.progress;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+
+ switch (index)
+ {
+ case 0:
+ this.tileEntity.progress=(short) value;
+ break;
+
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/LoomGui.java b/src/main/java/ihl/processing/chemistry/LoomGui.java
new file mode 100644
index 0000000..4964687
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/LoomGui.java
@@ -0,0 +1,60 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import ic2.core.IC2;
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+
+public class LoomGui extends GuiContainer {
+
+ private LoomContainer container;
+ protected static final ResourceLocation tex = new ResourceLocation("ihl", "textures/gui/GUILoom.png");
+
+ public LoomGui(LoomContainer latheContainer) {
+ super(latheContainer);
+ container = latheContainer;
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int i1;
+ if (this.container.tileEntity.progress > 0)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.99F);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(38),38);
+ this.drawTexturedModalRect(68, 30, 176, 0, i1 + 1, 10);
+ }
+ IHLRenderUtils.instance.drawTooltip(par1,par2,9,11,xOffset,yOffset,StatCollector.translateToLocal("ihl.coiler.tip"));
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ @Override
+ public void onGuiClosed()
+ {
+ super.onGuiClosed();
+ this.container.tileEntity.isGuiScreenOpened=false;
+ IC2.network.get().initiateClientTileEntityEvent(this.container.tileEntity, 0);
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/LoomModel.java b/src/main/java/ihl/processing/chemistry/LoomModel.java
new file mode 100644
index 0000000..31c2724
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/LoomModel.java
@@ -0,0 +1,66 @@
+package ihl.processing.chemistry;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class LoomModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer RotatePart;
+ IHLModelRenderer Piece1;
+
+ public LoomModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("RotatePart.Shape1", 0, 14);
+ setTextureOffset("RotatePart.Pipe2", 0, 17);
+ setTextureOffset("RotatePart.Shape4", 3, 14);
+ setTextureOffset("RotatePart.Shape3", 0, 26);
+ setTextureOffset("RotatePart.Pipe5", 16, 20);
+ setTextureOffset("RotatePart.Pipe6", 0, 18);
+ setTextureOffset("RotatePart.Pipe11", 13, 22);
+ setTextureOffset("RotatePart.Pipe12", 13, 22);
+ setTextureOffset("RotatePart.Pipe13", 13, 22);
+ setTextureOffset("RotatePart.Pipe14", 13, 22);
+ setTextureOffset("RotatePart.Pipe15", 13, 22);
+ setTextureOffset("Piece1.Shape7", 0, 17);
+ setTextureOffset("Piece1.Shape8", 0, 17);
+ setTextureOffset("Piece1.PipeW9", 0, 18);
+ setTextureOffset("Piece1.PipeW10", 0, 20);
+ setTextureOffset("Piece1.Shape2", 0, 0);
+
+ RotatePart = new IHLModelRenderer(this, "RotatePart");
+ RotatePart.setRotationPoint(0F, 23F, -6F);
+ setRotation(RotatePart, 0.4F, 0F, 0F);
+ RotatePart.mirror = true;
+ RotatePart.addBox("Shape1", 7F, -1F, -1F, 1, 2, 16,false);
+ RotatePart.addTube("Pipe2", -7.5F, -3F, 0F, 1, 2, 1, 0F,1F,ForgeDirection.UP);
+ RotatePart.addBox("Shape4", -8F, -1F, -1F, 1, 2, 16,false);
+ RotatePart.addBox("Shape3", -7F, -1F, -1F, 14, 2, 2,false);
+ RotatePart.addTube("Pipe5", -5.5F, -3F, 0F, 1, 2, 1, 0F,1F,ForgeDirection.UP);
+ RotatePart.addTube("Pipe6", -3.5F, -3F, 0F, 1, 2, 1, 0F,1F,ForgeDirection.UP);
+ RotatePart.addTube("Pipe11", -1.5F, -3F, 0F, 1, 2, 1, 0F,1F,ForgeDirection.UP);
+ RotatePart.addTube("Pipe12", 0.5F, -3F, 0F, 1, 2, 1, 0F,1F,ForgeDirection.UP);
+ RotatePart.addTube("Pipe13", 2.5F, -3F, 0F, 1, 2, 1, 0F,1F,ForgeDirection.UP);
+ RotatePart.addTube("Pipe14", 4.5F, -3F, 0F, 1, 2, 1, 0F,1F,ForgeDirection.UP);
+ RotatePart.addTube("Pipe15", 6.5F, -3F, 0F, 1, 2, 1, 0F,1F,ForgeDirection.UP);
+ Piece1 = new IHLModelRenderer(this, "Piece1");
+ Piece1.setRotationPoint(0F, 16F, 0F);
+ setRotation(Piece1, 0F, 0F, 0F);
+ Piece1.mirror = true;
+ Piece1.addBox("Shape7", 6F, -4F, 6F, 1, 12, 2,false);
+ Piece1.addBox("Shape8", -7F, -4F, 6F, 1, 12, 2,false);
+ Piece1.addTube("PipeW9", -6F, 7F, 7F, 12, 1, 1, 0F,1F,ForgeDirection.EAST);
+ Piece1.addTube("PipeW10", -6F, -4F, 6F, 12, 1, 1, 0F,1F,ForgeDirection.EAST);
+ Piece1.addBox("Shape2", 0F, 7F, 0F, 4, 1, 1,false);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/LoomTileEntity.java b/src/main/java/ihl/processing/chemistry/LoomTileEntity.java
new file mode 100644
index 0000000..8432a2d
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/LoomTileEntity.java
@@ -0,0 +1,172 @@
+package ihl.processing.chemistry;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.network.INetworkClientTileEntityEventListener;
+import ic2.api.recipe.IRecipeInput;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot.Access;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.recipes.RecipeInputWire;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+public class LoomTileEntity extends TileEntityInventory implements IHasGui, INetworkClientTileEntityEventListener
+{
+ protected static UniversalRecipeManager recipeManager = new UniversalRecipeManager("loom");
+ public short progress;
+ protected short operationLength=200;
+ public final ApparatusProcessableInvSlot input;
+ public final IHLInvSlotOutput output;
+ boolean isGuiScreenOpened=false;
+
+ public LoomTileEntity()
+ {
+ super();
+ input = new ApparatusProcessableInvSlot(this, "input", 0, Access.IO, 1, 64);
+ output = new IHLInvSlotOutput(this, "output", 1, 1);
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ if (this.canOperate() && this.isGuiScreenOpened)
+ {
+ this.setActive(true);
+
+ if (this.progress == 0)
+ {
+ IC2.network.get().initiateTileEntityEvent(this, 0, true);
+ }
+ ++this.progress;
+ if (this.progress >= this.operationLength)
+ {
+ this.operate();
+ this.progress = 0;
+ IC2.network.get().initiateTileEntityEvent(this, 2, true);
+ }
+ }
+ else
+ {
+ if (this.progress != 0 && this.getActive())
+ {
+ IC2.network.get().initiateTileEntityEvent(this, 1, true);
+ }
+ if (!this.canOperate())
+ {
+ this.progress = 0;
+ }
+ this.setActive(false);
+ }
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "Loom";
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer player)
+ {
+ return IHLUtils.getThisModItemStack("loom");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new LoomGui(new LoomContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ this.isGuiScreenOpened=true;
+ return new LoomContainer(player, this);
+ }
+
+ public void operate()
+ {
+ List<IRecipeInput> input1 = LoomTileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs();
+ List<?> output1 = LoomTileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
+ this.output.add(output1);
+ if(input1.get(0) instanceof RecipeInputWire)
+ {
+ int fiberLength = input1.get(0).getAmount();
+ boolean isFiberConsumed = IHLUtils.adjustWireLength(this.input.get(), -fiberLength);
+ if(isFiberConsumed)
+ {
+ this.input.put(null);
+ }
+ }
+ else
+ {
+ this.input.consume(input1.get(0));
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List[] getInput()
+ {
+ return new List[] {null,Arrays.asList(new ItemStack[] {input.get()})};
+ }
+
+ public boolean canOperate()
+ {
+ if(LoomTileEntity.recipeManager.getOutputFor(getInput())==null) return false;
+ List<?> output1 = LoomTileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
+ return this.output.canAdd(output1);
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer arg0) {}
+
+ public static void addRecipe(ItemStack input, ItemStack output)
+ {
+ if(input==null || output==null) throw new NullPointerException();
+ recipeManager.addRecipe(new UniversalRecipeInput(null,new ItemStack[] {input}), new UniversalRecipeOutput(null, new ItemStack[] {output},20));
+ }
+
+ public int gaugeProgressScaled(int i)
+ {
+ return this.progress * i / this.operationLength;
+ }
+
+ @Override
+ public void onNetworkEvent(EntityPlayer player, int event)
+ {
+ switch(event)
+ {
+ case 0:
+ this.isGuiScreenOpened=false;
+ break;
+ }
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/PaperMachineContainer.java b/src/main/java/ihl/processing/chemistry/PaperMachineContainer.java
new file mode 100644
index 0000000..01db6fd
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/PaperMachineContainer.java
@@ -0,0 +1,41 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraftforge.fluids.FluidStack;
+
+public class PaperMachineContainer extends BasicElectricMotorContainer<PaperMachineTileEntity> {
+
+ protected PaperMachineTileEntity tileEntity;
+ public int lastFluidAmount = -1;
+ public int lastNumberOfFluids = -1;
+ public short lastProgress = -1;
+ public short lastTemperature = -1;
+ public short lastEnergy = -1;
+ public List<FluidStack> fluidTankFluidList;
+
+ public PaperMachineContainer(EntityPlayer entityPlayer, PaperMachineTileEntity tileEntity1){
+ super(entityPlayer, tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList=this.tileEntity.getFluidTank().getFluidList();
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 78, 51));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 78, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 78, 33));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 122, 51));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ if (this.tileEntity.getTankAmount() != this.lastFluidAmount || this.tileEntity.getNumberOfFluidsInTank() != this.lastNumberOfFluids)
+ {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
+ this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
+ this.lastFluidAmount = this.tileEntity.getTankAmount();
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/PaperMachineGui.java b/src/main/java/ihl/processing/chemistry/PaperMachineGui.java
new file mode 100644
index 0000000..8fea247
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/PaperMachineGui.java
@@ -0,0 +1,79 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+@SideOnly(Side.CLIENT)
+public class PaperMachineGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIPaperMachine.png");
+ private PaperMachineContainer container;
+ private int mixerFrame=0;
+
+ public PaperMachineGui (PaperMachineContainer container1) {
+ //the container is instanciated and passed to the superclass for handling
+ super(container1);
+ this.container=container1;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(12, 16 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27),27);
+ this.drawTexturedModalRect(38, 29, getFrameX(i1), getFrameY(i1),24,24);
+ if(mixerFrame++>4)
+ {
+ mixerFrame=0;
+ }
+ }
+ else
+ {
+ mixerFrame=0;
+ }
+ this.drawTexturedModalRect(103, 52, 246, 226+6*mixerFrame,10,6);
+ if (this.container.tileEntity.getTankAmount() > 0)
+ {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 102, 28, 114, 59, zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ private int getFrameY(int number)
+ {
+ return (number % 10) * 24 + 14;
+ }
+
+ private int getFrameX(int number)
+ {
+ return (number / 10) * 24 + 176;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/PaperMachineTileEntity.java b/src/main/java/ihl/processing/chemistry/PaperMachineTileEntity.java
new file mode 100644
index 0000000..dddd306
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/PaperMachineTileEntity.java
@@ -0,0 +1,261 @@
+package ihl.processing.chemistry;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.processing.metallurgy.BasicElectricMotorTileEntity;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class PaperMachineTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler
+{
+ private final static UniversalRecipeManager recipeManager = new UniversalRecipeManager("papermachine");
+ public final IHLInvSlotOutput outputSlot;
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ private final IHLFluidTank fluidTank = new IHLFluidTank(8000);
+ public short temperature=20;
+
+ public PaperMachineTileEntity() {
+ super();
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 2);
+ this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 1);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=side;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("paperMachine");
+ }
+
+ @Override
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, fluidTank);
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, int amount, boolean doDrain)
+ {
+ FluidStack fstack = this.fluidTank.drain(amount, doDrain);
+ return fstack;
+ }
+
+
+ //1.7.10 API
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return direction.equals(ForgeDirection.UP);
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "chemicalReactor";
+ }
+
+ public float getRenderLiquidLevel()
+ {
+ return (float)this.fluidTank.getFluidAmount()/(float)this.fluidTank.getCapacity();
+ }
+
+ @Override
+ public int gaugeProgressScaled(int i)
+ {
+ return this.progress * i / operationLength;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new PaperMachineGui(new PaperMachineContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player)
+ {
+ this.fluidTank.sortFluidsByDensity();
+ return new PaperMachineContainer(player, this);
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer player) {}
+
+ @Override
+ public boolean canOperate()
+ {
+ UniversalRecipeOutput output = getOutput();
+ if(output!=null && this.outputSlot.canAdd(getOutput().getItemOutputs()))
+ {
+ if(output.specialConditions)
+ {
+ return this.checkSpecialConditions();
+ }
+ else
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean checkSpecialConditions()
+ {
+ ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing());
+ TileEntity te = worldObj.getTileEntity(xCoord+dir.offsetX, yCoord, zCoord+dir.offsetZ);
+ if(te instanceof CryogenicDistillerTileEntity)
+ {
+ CryogenicDistillerTileEntity cgte = (CryogenicDistillerTileEntity)te;
+ return cgte.getFacing()==this.getFacing() && cgte.canProcess();
+ }
+ return false;
+ }
+
+ public UniversalRecipeOutput getOutput()
+ {
+ return PaperMachineTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ @Override
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public List[] getInput()
+ {
+ return new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid()}), null};
+ }
+
+ @Override
+ public void operate()
+ {
+ UniversalRecipeInput recipeInput = PaperMachineTileEntity.recipeManager.getRecipeInput(getInput());
+ UniversalRecipeOutput output1 = getOutput();
+ this.fluidTank.drain(recipeInput.getFluidInputs(), true);
+ this.fluidTank.fill(output1.getFluidOutputs(), true);
+ if(!output1.getItemOutputs().isEmpty() && output1.getItemOutputs().get(0)!=null)this.outputSlot.add(output1.getItemOutputs());
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) {
+ if(fluidTank.getFluid()!=null && fluidTank.getFluid().containsFluid(fluidStack))
+ {
+ return this.fluidTank.drain(fluidStack, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.fluidTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[] {this.fluidTank.getInfo()};
+ }
+
+ public boolean needsFluid()
+ {
+ return this.fluidTank.getFluidAmount() <= this.fluidTank.getCapacity();
+ }
+
+ public FluidStack getFluidStackfromTank()
+ {
+ return this.fluidTank.getFluid();
+ }
+
+ public int getTankAmount()
+ {
+ return this.fluidTank.getFluidAmount();
+ }
+
+ public int gaugeLiquidScaled(int i, int index)
+ {
+ return this.fluidTank.getFluidAmount() <= 0 ? 0 : this.fluidTank.getFluidAmount(index) * i / this.fluidTank.getCapacity();
+ }
+ public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output)
+ {
+ recipeManager.addRecipe(input, output);
+ }
+
+ public int getNumberOfFluidsInTank()
+ {
+ return this.fluidTank.getNumberOfFluids();
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ public static void addRecipe(FluidStack fluidStackInput1, ItemStack itemStackOutput1)
+ {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] {fluidStackInput1}), null), new UniversalRecipeOutput(null, (new ItemStack[] {itemStackOutput1}),200));
+ }
+
+ public static void addSpecialConditionsRecipe(FluidStack fluidStackInput1, FluidStack fluidStackInput2, ItemStack itemStackInput, FluidStack fluidStackOutput, ItemStack itemStackOutput1, ItemStack itemStackOutput2)
+ {
+ addRecipe(new UniversalRecipeInput(new FluidStack[] {fluidStackInput1, fluidStackInput2}, (new ItemStack[] {itemStackInput})), new UniversalRecipeOutput((new FluidStack[] {fluidStackOutput}), (new ItemStack[] {itemStackOutput1, itemStackOutput2}),200, true));
+ }
+
+ public IHLFluidTank getFluidTank()
+ {
+ return this.fluidTank;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/RefluxCondenserModel.java b/src/main/java/ihl/processing/chemistry/RefluxCondenserModel.java
new file mode 100644
index 0000000..9cb2f2f
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/RefluxCondenserModel.java
@@ -0,0 +1,70 @@
+// Date: 05.04.2015 16:30:47
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+package ihl.processing.chemistry;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+
+public class RefluxCondenserModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+ IHLModelRenderer RotatingPartZ;
+
+ public RefluxCondenserModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.PipeUp03", 0, 0);
+ setTextureOffset("Base.KneeUpEast", 0, 0);
+ setTextureOffset("Base.WestPipe03", 0, 0);
+ setTextureOffset("Base.WestPipe04", 0, 0);
+ setTextureOffset("Base.WestPipe02", 0, 0);
+ setTextureOffset("Base.WestPipe01", 0, 0);
+ setTextureOffset("Base.Shape1", 0, 0);
+ setTextureOffset("Base.PipeUp06", 0, 0);
+ setTextureOffset("Base.PipeUp07", 0, 0);
+ setTextureOffset("Base.PipeNorth07", 0, 0);
+ setTextureOffset("Base.PipeNorth08", 0, 0);
+ setTextureOffset("RotatingPartZ.ConeWest05", 0, 0);
+ setTextureOffset("RotatingPartZ.PipeWest07", 0, 0);
+ setTextureOffset("RotatingPartZ.ConeEast06", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addTube("PipeUp03", -2F, 7F, -2F, 4, 1, 4, 0.6f, 1f,ForgeDirection.UP);
+ Base.addKnee("KneeUpEast", -8F, 2F, -3F, 5, 6, 6, .8F, 1F, ForgeDirection.UP, ForgeDirection.EAST);
+ Base.addTube("WestPipe03", 3.5F, -7F, -1.5F, 4, 3, 3, 0.8f, 1f,ForgeDirection.WEST);
+ Base.addTube("WestPipe04", 7F, -7.5F, -2F, 1, 4, 4, 0.6f, 1f,ForgeDirection.WEST);
+ Base.addTube("WestPipe02", 7F, 3F, -2F, 1, 4, 4, 0.6f, 1f,ForgeDirection.WEST);
+ Base.addTube("WestPipe01", -3F, 3.5F, -1.5F, 10, 3, 3, .8F, 1F, ForgeDirection.WEST);
+ Base.addTube("Shape1", -2F, -8F, -2F, 4, 1, 4, 0.6f, 1f,ForgeDirection.UP);
+ Base.addTube("PipeUp06", -1.5F, -7F, -1.5F, 3, 2, 3, 0.8f, 1f,ForgeDirection.UP);
+ Base.addTube("PipeUp07", -1.5F, 5F, -1.5F, 3, 2, 3, 0.8f, 1f,ForgeDirection.UP);
+ Base.addTube("PipeNorth07", -2F, -2F, -8F, 4, 4, 1, 0.6f, 1f,ForgeDirection.NORTH);
+ Base.addTube("PipeNorth08", -1.5F, -1.5F, -7F, 3, 3, 7, 0.8f, 1f,ForgeDirection.NORTH);
+ RotatingPartZ = new IHLModelRenderer(this, "RotatingPartZ");
+ RotatingPartZ.setRotationPoint(3F, 13F, 0F);
+ setRotation(RotatingPartZ, 0F, 0F, -0.5F);
+ RotatingPartZ.mirror = true;
+ RotatingPartZ.addTube("ConeWest05", 1F, -4F, -4F, 2, 8, 8, 0f, 0.8f,ForgeDirection.WEST);
+ RotatingPartZ.addTube("PipeWest07", -9F, -4F, -4F, 10, 8, 8, 0.8f, 1f,ForgeDirection.WEST);
+ RotatingPartZ.addTube("ConeEast06", -11F, -4F, -4F, 2, 8, 8, 0f, 0.8f,ForgeDirection.EAST);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/RefluxCondenserTileEntity.java b/src/main/java/ihl/processing/chemistry/RefluxCondenserTileEntity.java
new file mode 100644
index 0000000..83eb108
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/RefluxCondenserTileEntity.java
@@ -0,0 +1,148 @@
+package ihl.processing.chemistry;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ic2.api.network.INetworkDataProvider;
+import ic2.api.tile.IWrenchable;
+import ic2.core.IC2;
+import ihl.utils.IHLUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class RefluxCondenserTileEntity extends TileEntity implements IWrenchable, INetworkDataProvider, IFluidHandler{
+
+ private short facing=2;
+ private short lastFacing=2;
+ public FractionatorBottomTileEntity columnBottom;
+
+ public RefluxCondenserTileEntity()
+ {
+ super();
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = new ArrayList<String>();
+ fields.add("facing");
+ return fields;
+ }
+
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+ if(lastFacing!=facing)
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ lastFacing=facing;
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=side;
+ }
+
+
+ @Override
+ public short getFacing() {
+ return this.facing;
+ }
+
+
+ @Override
+ public void setFacing(short facing1)
+ {
+ facing=(short) Math.max(2,facing1);
+ if(IC2.platform.isSimulating())
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
+ return true;
+ }
+
+
+ @Override
+ public float getWrenchDropRate() {
+ return 1F;
+ }
+
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("refluxCondenser");
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ facing=nbttagcompound.getShort("facing");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setShort("facing", facing);
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return false;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return direction.equals(ForgeDirection.UP);
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return null;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, int arg1, boolean arg2) {
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection direction, FluidStack fluidStack, boolean doFill) {
+ if(fluidStack!=null && fluidStack.getFluid()!=null && this.canFill(direction, fluidStack.getFluid()) && columnBottom!=null)
+ {
+ return columnBottom.fill(direction, fluidStack, doFill);
+ }
+ return 0;
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0)
+ {
+ if(columnBottom!=null)
+ return columnBottom.getTankInfo(arg0);
+ else
+ return new FluidTankInfo[] {new FluidTankInfo(null, 8000)};
+ }
+
+}
diff --git a/src/main/java/ihl/processing/chemistry/SolarEvaporatorContainer.java b/src/main/java/ihl/processing/chemistry/SolarEvaporatorContainer.java
new file mode 100644
index 0000000..4ecf44d
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/SolarEvaporatorContainer.java
@@ -0,0 +1,112 @@
+package ihl.processing.chemistry;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class SolarEvaporatorContainer extends ContainerBase<SolarEvaporatorTileEntity> {
+
+ protected SolarEvaporatorTileEntity tileEntity;
+ public int lastFluidAmount = -1;
+ public int lastFuel = -1;
+ public short lastProgress = -1;
+ private final static int height = 166;
+ public int lastNumberOfFluids = -1;
+ public int lastVisibleFluidID = -1;
+ public int lastVisibleFluidAmount = -1;
+
+ public SolarEvaporatorContainer(EntityPlayer entityPlayer, SolarEvaporatorTileEntity tileEntity1) {
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ int col;
+
+ for (col = 0; col < 3; ++col) {
+ for (int col1 = 0; col1 < 9; ++col1) {
+ this.addSlotToContainer(
+ new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col) {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fluidItemsSlot, 0, 44, 14));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 44, 32));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillItemsSlot, 0, 44, 50));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 117, 32));
+
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+
+ if (this.tileEntity.getFluidTank().getFluid() != null
+ && this.tileEntity.getFluidTank().getFluidAmount() != this.lastFluidAmount) {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.getFluidTank().getFluid().getFluid().getID());
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getFluidTank().getFluidAmount());
+ }
+
+ if (this.tileEntity.fuel != this.lastFuel) {
+ icrafting.sendProgressBarUpdate(this, 2, this.tileEntity.fuel);
+ }
+
+ if (this.tileEntity.progress != this.lastProgress) {
+ icrafting.sendProgressBarUpdate(this, 3, this.tileEntity.progress);
+ }
+ if (this.tileEntity.visibleFluidId != this.lastVisibleFluidID)
+ {
+ icrafting.sendProgressBarUpdate(this, 4, this.tileEntity.visibleFluidId);
+ }
+ if (this.tileEntity.visibleFluidAmount != this.lastVisibleFluidAmount)
+ {
+ icrafting.sendProgressBarUpdate(this, 5, this.tileEntity.visibleFluidAmount);
+ }
+ }
+
+ this.lastFluidAmount = this.tileEntity.getFluidTank().getFluidAmount();
+ this.lastFuel = this.tileEntity.fuel;
+ this.lastProgress = this.tileEntity.progress;
+ this.lastVisibleFluidID=this.tileEntity.visibleFluidId;
+ this.lastVisibleFluidAmount=this.tileEntity.visibleFluidAmount;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value) {
+ super.updateProgressBar(index, value);
+
+ switch (index) {
+ case 0:
+ this.tileEntity.getFluidTank().setFluid(new FluidStack(FluidRegistry.getFluid(value), 1000));
+ break;
+ case 1:
+ this.tileEntity.getFluidTank()
+ .setFluid(new FluidStack(this.tileEntity.getFluidTank().getFluid().getFluid(), value));
+ break;
+ case 2:
+ this.tileEntity.fuel = value;
+ break;
+ case 3:
+ this.tileEntity.progress = (short) value;
+ break;
+ case 4:
+ this.tileEntity.visibleFluidId=value;
+ break;
+ case 5:
+ this.tileEntity.visibleFluidAmount=value;
+ break;
+
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/chemistry/SolarEvaporatorGui.java b/src/main/java/ihl/processing/chemistry/SolarEvaporatorGui.java
new file mode 100644
index 0000000..e97f9e0
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/SolarEvaporatorGui.java
@@ -0,0 +1,78 @@
+package ihl.processing.chemistry;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.util.DrawUtil;
+import ic2.core.util.GuiTooltipHelper;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+@SideOnly(Side.CLIENT)
+public class SolarEvaporatorGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl",
+ "textures/gui/GUISolarEvaporator.png");
+ private SolarEvaporatorContainer container;
+
+ public SolarEvaporatorGui(SolarEvaporatorContainer container1) {
+ // the container is instanciated and passed to the superclass for
+ // handling
+ super(container1);
+ this.container = container1;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.getActive()) {
+ this.drawTexturedModalRect(9, 16, 176, 0, 14, 14);
+ }
+ if (this.container.tileEntity.progress > 0) {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(18), 18);
+ this.drawTexturedModalRect(99, 34, 198, 0, i1 + 1, 13);
+ }
+
+ if (this.container.tileEntity.getTankAmount() > 0) {
+ FluidStack fluidStack = this.container.tileEntity.getFluidTank().getFluid();
+ if (fluidStack != null) {
+ Fluid fluid = fluidStack.getFluid();
+ if (fluid != null) {
+
+ IIcon fluidIcon = fluid.getIcon();
+
+ if (fluidIcon != null) {
+ this.mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
+ int liquidHeight = this.container.tileEntity.gaugeLiquidScaled(47);
+ DrawUtil.drawRepeated(fluidIcon, (82), 16 + 47 - liquidHeight, 12.0D, liquidHeight,
+ this.zLevel);
+ this.mc.renderEngine.bindTexture(background);
+ }
+ }
+ String tooltip = StatCollector.translateToLocal(fluidStack.getFluid().getUnlocalizedName()) + ": "
+ + fluidStack.amount + "mB";
+ GuiTooltipHelper.drawAreaTooltip(par1 - 90, par2 - 32, tooltip, xOffset - 8, yOffset - 15, xOffset + 2,
+ yOffset + 30);
+ }
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ // draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/chemistry/SolarEvaporatorTileEntity.java b/src/main/java/ihl/processing/chemistry/SolarEvaporatorTileEntity.java
new file mode 100644
index 0000000..947a88a
--- /dev/null
+++ b/src/main/java/ihl/processing/chemistry/SolarEvaporatorTileEntity.java
@@ -0,0 +1,108 @@
+package ihl.processing.chemistry;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ihl.interfaces.IFluidTankVisual;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.EnumSkyBlock;
+
+public class SolarEvaporatorTileEntity extends EvaporatorTileEntity implements IFluidTankVisual {
+ public int visibleFluidId = -1;
+ public int visibleFluidAmount = 1;
+
+ public SolarEvaporatorTileEntity(){
+ super();
+ this.fuelSlot = null;
+ this.maxProgress = 4500;
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> ret = super.getNetworkedFields();
+ ret.add("visibleFluidId");
+ ret.add("visibleFluidAmount");
+ return ret;
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ if(this.fluidTank.getFluid()!=null && (visibleFluidId!=this.fluidTank.getFluid().getFluid().getID() || visibleFluidAmount!=this.fluidTank.getFluidAmount()))
+ {
+ visibleFluidId = this.fluidTank.getFluid().getFluid().getID();
+ visibleFluidAmount = this.fluidTank.getFluidAmount();
+ IC2.network.get().updateTileEntityField(this, "visibleFluidId");
+ IC2.network.get().updateTileEntityField(this, "visibleFluidAmount");
+ }
+ else if(this.fluidTank.getFluid()==null && visibleFluidId!=-1)
+ {
+ visibleFluidId=-1;
+ IC2.network.get().updateTileEntityField(this, "visibleFluidId");
+ }
+ }
+ @Override
+ public boolean isBurning()
+ {
+ return this.worldObj.getSkyBlockTypeBrightness(EnumSkyBlock.Sky, xCoord, yCoord, zCoord)>=15;
+ }
+
+ @Override
+ public ContainerBase<? extends EvaporatorTileEntity> getGuiContainer(EntityPlayer entityPlayer)
+ {
+ return new SolarEvaporatorContainer(entityPlayer, this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin)
+ {
+ return new SolarEvaporatorGui(new SolarEvaporatorContainer(entityPlayer, this));
+ }
+
+ @Override
+ public short getFacing()
+ {
+ return 3;
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return false;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("solarEvaporator");
+ }
+
+ @Override
+ public int getVisibleFluidId() {
+ return this.visibleFluidId;
+ }
+
+ @Override
+ public int getVisibleFluidAmount() {
+ return this.visibleFluidAmount;
+ }
+
+ @Override
+ public float getRenderLiquidLevel()
+ {
+ return (float)this.visibleFluidAmount/(float)this.fluidTank.getCapacity()/2;
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+}
diff --git a/src/main/java/ihl/processing/invslots/IHLInvSlotOutput.java b/src/main/java/ihl/processing/invslots/IHLInvSlotOutput.java
new file mode 100644
index 0000000..d5186e2
--- /dev/null
+++ b/src/main/java/ihl/processing/invslots/IHLInvSlotOutput.java
@@ -0,0 +1,166 @@
+package ihl.processing.invslots;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.recipes.RecipeOutputItemStack;
+import ihl.utils.IHLUtils;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+public class IHLInvSlotOutput extends InvSlotOutput {
+
+ private final Map<Long, Float> substanceAmount = new HashMap<Long, Float>();
+
+ public IHLInvSlotOutput(TileEntityInventory base1, String name1, int oldStartIndex1, int count) {
+ super(base1, name1, oldStartIndex1, count);
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public boolean canAdd(List itemOutputs) {
+ if (itemOutputs == null || itemOutputs.isEmpty()) {
+ return true;
+ }
+ Iterator ioi = itemOutputs.iterator();
+ if (this.size() >= itemOutputs.size()) {
+ Object rois;
+ if (ioi.hasNext()) {
+ rois = ioi.next();
+ } else {
+ return true;
+ }
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) == null || (this.objectMatchesSlot(rois, i)
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) < this.getStackSizeLimit()
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) <= this.get(i).getMaxStackSize())) {
+ if (ioi.hasNext()) {
+ rois = ioi.next();
+ } else {
+ return true;
+ }
+ } else {
+ if (i == this.size() - 1) {
+ return false;
+ }
+ }
+ }
+
+ }
+ return false;
+ }
+
+ private float getAmoutOfObject(Object obj) {
+ if (obj instanceof ItemStack) {
+ return ((ItemStack) obj).stackSize;
+ } else if (obj instanceof RecipeOutputItemStack) {
+ return ((RecipeOutputItemStack) obj).quantity;
+ }
+ return Short.MAX_VALUE;
+ }
+
+ public boolean objectMatchesSlot(Object obj, int slot) {
+ if (this.get(slot) == null) {
+ return true;
+ } else {
+ if (obj instanceof ItemStack) {
+ return IHLUtils.isItemStacksIsEqual(this.get(slot), (ItemStack) obj, true);
+ } else if (obj instanceof RecipeOutputItemStack) {
+ return ((RecipeOutputItemStack) obj).matches(this.get(slot));
+ }
+ }
+ return false;
+ }
+
+ public void add(RecipeOutputItemStack rois) {
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) == null || (this.objectMatchesSlot(rois, i)
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) < this.getStackSizeLimit())) {
+ this.add(i, rois);
+ break;
+ }
+ }
+ }
+
+ private void add(int i, RecipeOutputItemStack rois) {
+ long key = (Item.getIdFromItem(rois.itemStack.getItem()) << 32) + rois.itemStack.getItemDamage();
+ float amount = 0f;
+ if (this.substanceAmount.containsKey(key)) {
+ amount = this.substanceAmount.get(key);
+ }
+ amount += rois.quantity;
+ while (amount >= 1) {
+ amount--;
+ this.add(rois.itemStack.copy());
+ }
+ this.substanceAmount.put(key, amount);
+ }
+
+ @Override
+ @SuppressWarnings("rawtypes")
+ public int add(List itemOutputs) {
+ if (itemOutputs == null || itemOutputs.isEmpty()) {
+ return 0;
+ }
+ Iterator ioi = itemOutputs.iterator();
+ if (this.size() >= itemOutputs.size() && ioi.hasNext()) {
+ Object rois = ioi.next();
+ for (int i = 0; i < this.size(); i++) {
+ if (this.get(i) == null || (this.objectMatchesSlot(rois, i)
+ && this.get(i).stackSize + this.getAmoutOfObject(rois) < this.getStackSizeLimit())) {
+ if (rois instanceof ItemStack) {
+ this.add(((ItemStack) rois).copy());
+ } else if (rois instanceof RecipeOutputItemStack) {
+ this.add(i, (RecipeOutputItemStack) rois);
+ }
+ if (ioi.hasNext()) {
+ rois = ioi.next();
+ } else {
+ return itemOutputs.size();
+ }
+ } else {
+ if (i == this.size() - 1) {
+ return 0;
+ }
+ }
+ }
+
+ }
+ return 0;
+ }
+
+ @Override
+ public void readFromNbt(NBTTagCompound nbtTagCompound) {
+ super.readFromNbt(nbtTagCompound);
+ NBTTagList amountTagList = nbtTagCompound.getTagList("substanceAmountMap", 10);
+ for (int i = 0; i < amountTagList.tagCount(); i++) {
+ if (amountTagList.getCompoundTagAt(i).hasKey("substanceKey")) {
+ long substanceKey = amountTagList.getCompoundTagAt(i).getLong("substanceKey");
+ float substanceAmount = amountTagList.getCompoundTagAt(i).getFloat("substanceAmount");
+ this.substanceAmount.put(substanceKey, substanceAmount);
+ }
+ }
+ }
+
+ @Override
+ public void writeToNbt(NBTTagCompound nbtTagCompound) {
+ super.writeToNbt(nbtTagCompound);
+ NBTTagList sAmountsList = new NBTTagList();
+ Iterator<Entry<Long, Float>> entrySetIterator = this.substanceAmount.entrySet().iterator();
+ while (entrySetIterator.hasNext()) {
+ Entry<Long, Float> entry = entrySetIterator.next();
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setLong("substanceKey", entry.getKey());
+ tag.setFloat("substanceAmount", entry.getValue());
+ sAmountsList.appendTag(tag);
+ }
+ nbtTagCompound.setTag("substanceAmountMap", sAmountsList);
+ }
+}
diff --git a/src/main/java/ihl/processing/invslots/InvSlotConsumableLiquidIHL.java b/src/main/java/ihl/processing/invslots/InvSlotConsumableLiquidIHL.java
new file mode 100644
index 0000000..7bb6ecc
--- /dev/null
+++ b/src/main/java/ihl/processing/invslots/InvSlotConsumableLiquidIHL.java
@@ -0,0 +1,271 @@
+package ihl.processing.invslots;
+
+import java.util.Iterator;
+
+import org.apache.commons.lang3.mutable.MutableObject;
+
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.util.StackUtil;
+import ihl.utils.IHLUtils;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidContainerRegistry;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidContainerItem;
+
+public class InvSlotConsumableLiquidIHL extends InvSlotConsumableLiquid{
+
+ private OpType opType;
+ private String additionalInputs;
+
+ public InvSlotConsumableLiquidIHL(TileEntityInventory base1, String name1,int oldStartIndex1, Access access1, int count,InvSide preferredSide1, OpType opType1)
+ {
+ super(base1, name1, oldStartIndex1, access1, count, preferredSide1, opType1);
+ opType=opType1;
+ }
+
+ public InvSlotConsumableLiquidIHL(TileEntityInventory base1, String name1,int oldStartIndex1, Access access1, int count,InvSide preferredSide1, OpType opType1, String additionalInputs1)
+ {
+ super(base1, name1, oldStartIndex1, access1, count, preferredSide1, opType1);
+ opType=opType1;
+ additionalInputs=additionalInputs1;
+ }
+
+ @Override
+ public FluidStack drain(Fluid fluid, int maxAmount, MutableObject<ItemStack> output, boolean simulate)
+ {
+ if(output!=null)
+ {
+ output.setValue((ItemStack)null);
+ }
+
+ if (this.opType != InvSlotConsumableLiquid.OpType.Drain && this.opType != InvSlotConsumableLiquid.OpType.Both)
+ {
+ return null;
+ }
+ else
+ {
+ ItemStack stack = this.get();
+
+ if (stack == null)
+ {
+ return null;
+ }
+ else if (!FluidContainerRegistry.isFilledContainer(stack))
+ {
+ if (stack.getItem() instanceof IFluidContainerItem)
+ {
+ IFluidContainerItem var9 = (IFluidContainerItem)stack.getItem();
+
+ if (var9.getFluid(stack) == null)
+ {
+ return null;
+ }
+ else if (fluid != null && var9.getFluid(stack).getFluid() != fluid)
+ {
+ return null;
+ }
+ else if (!this.acceptsLiquid(var9.getFluid(stack).getFluid()))
+ {
+ return null;
+ }
+ else
+ {
+ ItemStack singleStack = StackUtil.copyWithSize(stack, 1);
+ FluidStack fluidStack = var9.drain(singleStack, maxAmount, true);
+
+ if (fluidStack != null && fluidStack.amount > 0)
+ {
+ if (singleStack.stackSize <= 0)
+ {
+ if (!simulate)
+ {
+ --stack.stackSize;
+ }
+ }
+ else if (var9.getFluid(singleStack) == null)
+ {
+ if(output!=null)
+ {
+ output.setValue(singleStack);
+ }
+ if (!simulate)
+ {
+ --stack.stackSize;
+ }
+ }
+ else
+ {
+ if (stack.stackSize > 1)
+ {
+ return null;
+ }
+
+ if (!simulate)
+ {
+ this.put(singleStack);
+ }
+ }
+
+ if (stack.stackSize <= 0)
+ {
+ this.put((ItemStack)null);
+ }
+
+ return fluidStack;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
+ FluidStack container = FluidContainerRegistry.getFluidForFilledItem(stack);
+
+ if (container != null && (fluid == null || fluid == container.getFluid()))
+ {
+ if (!this.acceptsLiquid(container.getFluid()))
+ {
+ return null;
+ }
+ else if (container.amount > 0 && container.amount <= maxAmount)
+ {
+ if (stack.getItem().hasContainerItem(stack) && output!=null)
+ {
+ output.setValue(stack.getItem().getContainerItem(stack));
+ }
+ else
+ {
+ ItemStack emptystack = FluidContainerRegistry.drainFluidContainer(stack);
+ if(emptystack!=null && output!=null)
+ {
+ output.setValue(emptystack);
+ }
+ }
+
+ if (!simulate)
+ {
+ --stack.stackSize;
+
+ if (stack.stackSize <= 0)
+ {
+ this.put((ItemStack)null);
+ }
+ }
+
+ return container;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean accepts(ItemStack stack)
+ {
+ if (stack == null)
+ {
+ return true;
+ }
+ Item item = stack.getItem();
+ if (item == null)
+ {
+ return false;
+ }
+ else
+ {
+ if(this.additionalInputs!=null)
+ {
+ String fon = IHLUtils.getFirstOreDictName(stack);
+ if(fon!=null && fon.contains(additionalInputs))
+ {
+ return true;
+ }
+ }
+ if (this.opType == InvSlotConsumableLiquid.OpType.Drain || this.opType == InvSlotConsumableLiquid.OpType.Both)
+ {
+ FluidStack containerItem = null;
+ if (FluidContainerRegistry.isFilledContainer(stack))
+ {
+ containerItem = FluidContainerRegistry.getFluidForFilledItem(stack);
+ }
+ else if (item instanceof IFluidContainerItem)
+ {
+ containerItem = ((IFluidContainerItem)item).getFluid(stack);
+ }
+
+ if (containerItem != null && containerItem.amount > 0)
+ {
+ return true;
+ }
+ }
+ if (this.opType == InvSlotConsumableLiquid.OpType.Fill || this.opType == InvSlotConsumableLiquid.OpType.Both)
+ {
+ if (FluidContainerRegistry.isEmptyContainer(stack))
+ {
+ if (this.getPossibleFluids() == null)
+ {
+ return true;
+ }
+
+ Iterator<Fluid> containerItem1 = this.getPossibleFluids().iterator();
+
+ while (containerItem1.hasNext())
+ {
+ Fluid prevFluid = containerItem1.next();
+
+ if (FluidContainerRegistry.fillFluidContainer(new FluidStack(prevFluid, Integer.MAX_VALUE), stack) != null)
+ {
+ return true;
+ }
+ }
+ }
+ else if (item instanceof IFluidContainerItem)
+ {
+ IFluidContainerItem containerItem2 = (IFluidContainerItem)item;
+ FluidStack prevFluid1 = containerItem2.getFluid(stack);
+
+ if (prevFluid1 == null || containerItem2.getCapacity(stack) > prevFluid1.amount)
+ {
+ if (this.getPossibleFluids() == null)
+ {
+ return true;
+ }
+
+ ItemStack singleStack = StackUtil.copyWithSize(stack, 1);
+ Iterator<Fluid> i$ = this.getPossibleFluids().iterator();
+
+ while (i$.hasNext())
+ {
+ Fluid fluid = i$.next();
+
+ if (containerItem2.fill(singleStack, new FluidStack(fluid, Integer.MAX_VALUE), false) > 0)
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/invslots/InvSlotUpgradeIHL.java b/src/main/java/ihl/processing/invslots/InvSlotUpgradeIHL.java
new file mode 100644
index 0000000..5c1fff9
--- /dev/null
+++ b/src/main/java/ihl/processing/invslots/InvSlotUpgradeIHL.java
@@ -0,0 +1,61 @@
+package ihl.processing.invslots;
+
+import ic2.core.Ic2Items;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot;
+import ihl.utils.IHLUtils;
+import net.minecraft.item.ItemStack;
+
+public class InvSlotUpgradeIHL extends InvSlot {
+
+ public InvSlotUpgradeIHL(int count) {
+ super(count);
+ }
+
+ public InvSlotUpgradeIHL(TileEntityInventory base, int oldStartIndex, Access access, int count, InvSide side) {
+ super(base, "invSlotUpgrade", oldStartIndex, access, count, side);
+ }
+
+ public double getPowerConsumtionMultiplier() {
+ double base = 1d;
+ for (int i = 0; i < this.size(); i++) {
+ if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.overclockerUpgrade, false)) {
+ int i1 = this.get(i).stackSize;
+ while (i1-- > 0 && base < 600) {
+ base *= 1.6f;
+ }
+ }
+ }
+ return base;
+ }
+
+ public float getProgressMultiplier() {
+ float base = 1f;
+ for (int i = 0; i < this.size(); i++) {
+ if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.overclockerUpgrade, false)) {
+ int i1 = this.get(i).stackSize;
+ while (i1-- > 0 && base < 600) {
+ base *= 1.428571429f;
+ }
+ }
+ }
+ return base;
+ }
+
+ public int getAdditionalEnergyStorage() {
+ int base = 0;
+ for (int i = 0; i < this.size(); i++) {
+ if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.energyStorageUpgrade, false)) {
+ base += this.get(i).stackSize * 10000;
+ }
+ }
+ return base;
+ }
+
+ @Override
+ public boolean accepts(ItemStack stack) {
+ return IHLUtils.isItemStacksIsEqual(stack, Ic2Items.overclockerUpgrade, false) ||
+ IHLUtils.isItemStacksIsEqual(stack, Ic2Items.energyStorageUpgrade, false);
+ }
+
+}
diff --git a/src/main/java/ihl/processing/invslots/SlotInvSlotIronWorkbench.java b/src/main/java/ihl/processing/invslots/SlotInvSlotIronWorkbench.java
new file mode 100644
index 0000000..7f00e06
--- /dev/null
+++ b/src/main/java/ihl/processing/invslots/SlotInvSlotIronWorkbench.java
@@ -0,0 +1,32 @@
+package ihl.processing.invslots;
+
+import ic2.core.slot.SlotInvSlot;
+import ihl.flexible_cable.IronWorkbenchInvSlot;
+import ihl.flexible_cable.IronWorkbenchTileEntity;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class SlotInvSlotIronWorkbench extends SlotInvSlot {
+
+ public IronWorkbenchInvSlot invSlot;
+
+ public SlotInvSlotIronWorkbench(IronWorkbenchInvSlot invSlot1, int index1,
+ int xDisplayPosition1, int yDisplayPosition1) {
+ super(invSlot1, index1, xDisplayPosition1, yDisplayPosition1);
+ this.invSlot=invSlot1;
+
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer player)
+ {
+ return this.invSlot.getCanTakeStack();
+ }
+
+
+ @Override
+ public void onSlotChanged()
+ {
+ super.onSlotChanged();
+ ((IronWorkbenchTileEntity)this.invSlot.base).resetOutput();
+ }
+}
diff --git a/src/main/java/ihl/processing/invslots/SlotInvSlotOutputInProgress.java b/src/main/java/ihl/processing/invslots/SlotInvSlotOutputInProgress.java
new file mode 100644
index 0000000..25c0673
--- /dev/null
+++ b/src/main/java/ihl/processing/invslots/SlotInvSlotOutputInProgress.java
@@ -0,0 +1,23 @@
+package ihl.processing.invslots;
+
+import ic2.core.slot.SlotInvSlot;
+import ihl.flexible_cable.IronWorkbenchInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class SlotInvSlotOutputInProgress extends SlotInvSlot {
+
+ public IronWorkbenchInvSlot invSlot;
+
+ public SlotInvSlotOutputInProgress(IronWorkbenchInvSlot invSlot1, int index1,
+ int xDisplayPosition1, int yDisplayPosition1) {
+ super(invSlot1, index1, xDisplayPosition1, yDisplayPosition1);
+ this.invSlot=invSlot1;
+
+ }
+
+ @Override
+ public boolean canTakeStack(EntityPlayer player)
+ {
+ return this.invSlot.getCanTakeStack();
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/AchesonFurnaceGui.java b/src/main/java/ihl/processing/metallurgy/AchesonFurnaceGui.java
new file mode 100644
index 0000000..6f8238a
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/AchesonFurnaceGui.java
@@ -0,0 +1,46 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+
+public class AchesonFurnaceGui extends GuiContainer {
+ protected static final ResourceLocation achesonFurnaceBackground = new ResourceLocation("ihl", "textures/gui/GUIAchesonFurnace.png");
+ private MachineBaseContainer container;
+
+ public AchesonFurnaceGui(MachineBaseContainer machineBaseContainer) {
+ super(machineBaseContainer);
+ this.container=machineBaseContainer;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(achesonFurnaceBackground);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(8, 6 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17),17);
+ this.drawTexturedModalRect(70,34, 197, 0, i1 + 1, 13);
+ }
+ fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ihl.gui.achesonFurnance"), 40, 12, 16768125);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(achesonFurnaceBackground);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/AchesonFurnanceContainer.java b/src/main/java/ihl/processing/metallurgy/AchesonFurnanceContainer.java
new file mode 100644
index 0000000..2580c6c
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/AchesonFurnanceContainer.java
@@ -0,0 +1,16 @@
+package ihl.processing.metallurgy;
+
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class AchesonFurnanceContainer extends MachineBaseContainer {
+
+ public AchesonFurnanceContainer(EntityPlayer entityPlayer,
+ AchesonFurnanceTileEntity tileEntity1) {
+ super(entityPlayer, tileEntity1);
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 40, 22));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 40, 40));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 98, 32));
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java b/src/main/java/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java
new file mode 100644
index 0000000..75efd70
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/AchesonFurnanceTileEntity.java
@@ -0,0 +1,101 @@
+package ihl.processing.metallurgy;
+
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.recipe.IRecipeInput;
+import ic2.core.ContainerBase;
+import ihl.IHLMod;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.recipes.RecipeOutputItemStack;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+public class AchesonFurnanceTileEntity extends MachineBaseTileEntity {
+
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("achesonfurnace");
+ public final IHLInvSlotOutput outputSlot;
+
+ public AchesonFurnanceTileEntity() {
+ super(2);
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
+ }
+
+ public static void addRecipe(IRecipeInput input1, IRecipeInput input2, String output1) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, new IRecipeInput[] { input1, input2 }),
+ new UniversalRecipeOutput(null, new ItemStack[] { IHLUtils.getThisModItemStack(output1) }, 20));
+ }
+
+ @Override
+ public String getStartSoundFile() {
+ return "Machines/Electro Furnace/ElectroFurnaceLoop.ogg";
+ }
+
+ @Override
+ public String getLoopSoundFile() {
+ return null;
+ }
+
+ @Override
+ public String getStopSoundFile() {
+ return null;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "AchesonFurnance";
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new AchesonFurnaceGui(new AchesonFurnanceContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new AchesonFurnanceContainer(player, this);
+ }
+
+ @Override
+ public void operate() {
+ ItemStack crucible = input.getItemStack(IHLMod.crucible);
+ if (crucible != null) {
+ ((Crucible) crucible.getItem()).processContent(crucible, this);
+ return;
+ }
+ List<RecipeOutputItemStack> output = recipeManager
+ .getOutputFor(getInput()).getItemOutputs();
+ List<IRecipeInput> rinput = recipeManager.getRecipeInput(getInput()).getItemInputs();
+ for (int i = 0; i < rinput.size(); i++) {
+ this.input.consume(rinput.get(i));
+ }
+ this.outputSlot.add(output);
+ }
+
+ @Override
+ public boolean canOperate() {
+ return this.getOutput() != null;
+ }
+
+ @Override
+ public List<?>[] getInput() {
+ return new List[] { null, this.input.getItemStackList() };
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ @Override
+ public UniversalRecipeOutput getOutput() {
+ return AchesonFurnanceTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java b/src/main/java/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java
new file mode 100644
index 0000000..a546b0a
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/BasicElectricMotorTileEntity.java
@@ -0,0 +1,272 @@
+package ihl.processing.metallurgy;
+
+import java.util.Iterator;
+import java.util.List;
+
+import ic2.api.energy.event.EnergyTileLoadEvent;
+import ic2.api.energy.event.EnergyTileUnloadEvent;
+import ic2.api.energy.tile.IEnergySink;
+import ic2.api.network.INetworkClientTileEntityEventListener;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlot.Access;
+import ihl.IHLMod;
+import ihl.flexible_cable.FlexibleCableHolderBaseTileEntity;
+import ihl.flexible_cable.NodeEntity;
+import ihl.processing.invslots.InvSlotUpgradeIHL;
+import ihl.utils.IHLInvSlotDischarge;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public abstract class BasicElectricMotorTileEntity extends FlexibleCableHolderBaseTileEntity
+ implements IHasGui, INetworkClientTileEntityEventListener, IEnergySink {
+
+ public final IHLInvSlotDischarge dischargeSlot;
+ public final InvSlotUpgradeIHL upgradeSlot;
+ public short progress;
+ protected short operationLength = 6000;
+ protected double energyConsume = 1d;
+ public double energy = 0d;
+ public int maxStorage = 128;
+ private boolean addedToEnergyNet = false;
+
+ public BasicElectricMotorTileEntity() {
+ super();
+ energyConsume = IHLMod.config.machineryEnergyConsume/100d;
+ dischargeSlot = new IHLInvSlotDischarge(this, 1, Access.I, 4, InvSlot.InvSide.BOTTOM);
+ upgradeSlot = new InvSlotUpgradeIHL(this, 1, Access.I, 4, InvSlot.InvSide.BOTTOM);
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "Lathe";
+ }
+
+ public boolean enableUpdateEntity() {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void onLoaded() {
+ super.onLoaded();
+ if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+ }
+
+ @Override
+ public void onUnloaded() {
+ if (IC2.platform.isSimulating() && this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+
+ super.onUnloaded();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void setFacing(short facing1) {
+ double d = 0.3D;
+ double f = -0.1D;
+ if (IC2.platform.isSimulating() && this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+ double range = 2D;
+ AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(connectionX - range, connectionY - range,
+ connectionZ - range, connectionX + range, connectionY + range, connectionZ + range);
+ List<NodeEntity> nodeList = worldObj.getEntitiesWithinAABB(NodeEntity.class, searchArea);
+ super.setFacing(facing1);
+ switch (getFacing()) {
+ case 4:
+ setConnectionX(this.xCoord + 0.5D);
+ setConnectionY(this.yCoord + d);
+ setConnectionZ(this.zCoord + 1D - f);
+ break;
+ case 5:
+ setConnectionX(this.xCoord + 0.5D);
+ setConnectionY(this.yCoord + d);
+ setConnectionZ(this.zCoord + f);
+ break;
+ case 2:
+ setConnectionX(this.xCoord + 1D - f);
+ setConnectionY(this.yCoord + d);
+ setConnectionZ(this.zCoord + 0.5D);
+ break;
+ case 3:
+ setConnectionX(this.xCoord + f);
+ setConnectionY(this.yCoord + d);
+ setConnectionZ(this.zCoord + 0.5D);
+ break;
+ default:
+ setConnectionX(this.xCoord + 1D - f);
+ setConnectionY(this.yCoord + d);
+ setConnectionZ(this.zCoord + 0.5D);
+ break;
+
+ }
+ if (!nodeList.isEmpty()) {
+ Iterator<NodeEntity> ei = nodeList.iterator();
+ while (ei.hasNext()) {
+ NodeEntity ne = ei.next();
+ if ((ne.prevAnchorEntity == null || ne.nextAnchorEntity == null)
+ && this.cableListContains(ne.getChainUniqueID())) {
+ ne.setVirtualNodePos(connectionX, connectionY, connectionZ);
+ }
+ }
+ }
+ if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+ }
+
+ @Override
+ public double getDemandedEnergy() {
+ if(this.getMaxStorage() - this.energy <= 1d)
+ {
+ return 0d;
+ }
+ return this.getMaxStorage() - this.energy;
+ }
+
+ @Override
+ public int getSinkTier() {
+ return 4;
+ }
+
+ @Override
+ public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) {
+ if (this.energy < this.getMaxStorage()) {
+ this.energy += amount;
+ return 0.0D;
+ } else {
+ return amount;
+ }
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing() != (short) side;
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt) {
+ super.writeToNBT(nbt);
+ nbt.setShort("progress", this.progress);
+ nbt.setDouble("energy", this.energy);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+ this.progress = nbt.getShort("progress");
+ this.energy = nbt.getDouble("energy");
+ }
+
+ @Override
+ public void onNetworkEvent(EntityPlayer player, int event) {
+ switch (event) {
+ case 0:
+ break;
+ }
+ }
+
+ public abstract void operate();
+
+ @Override
+ public void updateEntityServer() {
+ if (this.getDemandedEnergy() > 1.0D) {
+ double amount = this.dischargeSlot.discharge(this.getDemandedEnergy(), false);
+ this.energy += amount;
+ }
+ if (this.gridID != -1 && this.getGrid().energy > 0D && this.energy < this.getMaxStorage()) {
+ this.energy += energyConsume * 10D;
+ this.getGrid().drawEnergy(energyConsume * 10D, this);
+ }
+ if (this.canOperate() && this.energy >= this.energyConsume) {
+ this.energy -= this.energyConsume * this.upgradeSlot.getPowerConsumtionMultiplier();
+ if (this.progress == 0) {
+ IC2.network.get().initiateTileEntityEvent(this, 0, true);
+ }
+ this.progress+=(short)(10*this.upgradeSlot.getProgressMultiplier());
+ if (this.progress >= this.operationLength) {
+ this.operate();
+ this.progress = 0;
+ IC2.network.get().initiateTileEntityEvent(this, 2, true);
+ }
+ } else {
+ if (this.progress != 0 && this.getActive()) {
+ IC2.network.get().initiateTileEntityEvent(this, 1, true);
+ }
+ if (!this.canOperate()) {
+ this.progress = 0;
+ }
+ }
+
+ }
+
+ private double getMaxStorage() {
+ return maxStorage+this.upgradeSlot.getAdditionalEnergyStorage();
+ }
+
+ public abstract List<?>[] getInput();
+
+ public abstract boolean canOperate();
+
+ @Override
+ public void onGuiClosed(EntityPlayer arg0) {
+ }
+
+ public int getEnergy() {
+ return (int) this.energy;
+ }
+
+ public int getGUIEnergy(int i) {
+ if (this.energy < Float.MAX_VALUE) {
+ return Math.round((float) (this.energy / this.getMaxStorage() * i));
+ } else {
+ return Math.round((float) (this.energy / this.getMaxStorage()) * i);
+ }
+ }
+
+ public int gaugeProgressScaled(int i) {
+ return this.progress * i / this.operationLength;
+ }
+
+ public void setEnergy(int value) {
+ this.energy = value;
+ }
+
+ @Override
+ public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) {
+ return true;
+ }
+
+ @Override
+ public double getMaxAllowableVoltage() {
+ return 64000D;
+ }
+
+ @Override
+ public double getEnergyAmountThisNodeWant() {
+ return this.getMaxStorage()-this.energy;
+ }
+
+ public double drawEnergyToGrid(double amount) {
+ return 0d;
+ }
+
+ @Override
+ public void injectEnergyInThisNode(double amount, double voltage) {
+ this.energy += amount;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/CoilerContainer.java b/src/main/java/ihl/processing/metallurgy/CoilerContainer.java
new file mode 100644
index 0000000..710a708
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/CoilerContainer.java
@@ -0,0 +1,65 @@
+package ihl.processing.metallurgy;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class CoilerContainer extends ContainerBase<CoilerTileEntity> {
+
+ public CoilerTileEntity tileEntity;
+ private short lastEnergy = -1;
+ private final static int height=166;
+
+ public CoilerContainer(EntityPlayer entityPlayer,
+ CoilerTileEntity lathePart1TileEntity) {
+ super(lathePart1TileEntity);
+ tileEntity=lathePart1TileEntity;
+ int col;
+
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.output, 0, 69, 22));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.dischargeSlot,0, 22, 55));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ if (this.tileEntity.getEnergy() != this.lastEnergy)
+ {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getEnergy());
+ }
+ }
+ this.lastEnergy = (short) this.tileEntity.getEnergy();
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+
+ switch (index)
+ {
+ case 1:
+ this.tileEntity.setEnergy(value);
+ break;
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/CoilerGui.java b/src/main/java/ihl/processing/metallurgy/CoilerGui.java
new file mode 100644
index 0000000..b635506
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/CoilerGui.java
@@ -0,0 +1,48 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+
+public class CoilerGui extends GuiContainer {
+
+ private CoilerContainer container;
+ protected static final ResourceLocation tex = new ResourceLocation("ihl", "textures/gui/GUICoiler.png");
+
+ public CoilerGui(CoilerContainer latheContainer) {
+ super(latheContainer);
+ container = latheContainer;
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ihl.gui.coiler"), 40, 12, 16768125);
+ this.mc.renderEngine.bindTexture(tex);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(39, 55 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ IHLRenderUtils.instance.drawTooltip(par1,par2,9,11,xOffset,yOffset,StatCollector.translateToLocal("ihl.coiler.tip"));
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/CoilerModel.java b/src/main/java/ihl/processing/metallurgy/CoilerModel.java
new file mode 100644
index 0000000..9c1721e
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/CoilerModel.java
@@ -0,0 +1,103 @@
+package ihl.processing.metallurgy;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class CoilerModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+ IHLModelRenderer RotatingPart2;
+ IHLModelRenderer MotorPart1;
+ IHLModelRenderer MotorPart2;
+ IHLModelRenderer Belt;
+ IHLModelRenderer Belt2;
+ IHLModelRenderer CoilRotating;
+ IHLModelRenderer Coil;
+
+ public CoilerModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 0);
+ setTextureOffset("Base.Shape3", 0, 0);
+ setTextureOffset("Base.Shape2", 0, 0);
+ setTextureOffset("Base.Shape16", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN1", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN7", 49, 23);
+ setTextureOffset("RotatingPart2.PipeN4", 0, 17);
+ setTextureOffset("RotatingPart2.PipeN14", 0, 19);
+ setTextureOffset("RotatingPart2.PipeN17", 0, 17);
+ setTextureOffset("MotorPart1.PipeN41", 0, 0);
+ setTextureOffset("MotorPart1.PipeN12", 0, 0);
+ setTextureOffset("MotorPart1.PipeN13", 0, 0);
+ setTextureOffset("MotorPart2.Shape4", 0, 24);
+ setTextureOffset("MotorPart2.Shape7", 0, 9);
+ setTextureOffset("MotorPart2.Shape10", 0, 9);
+ setTextureOffset("Belt.Shape12", 0, 0);
+ setTextureOffset("Belt2.Shape13", 0, 0);
+ setTextureOffset("CoilRotating.PipeN15", 22, 19);
+ setTextureOffset("Coil.Shape1", 22, 30);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, -8F, 16, 1, 16);
+ Base.addBox("Shape3", -5F, 0F, -7F, 4, 7, 1);
+ Base.addBox("Shape2", -5.5F, -1F, 7F, 5, 8, 1);
+ Base.addBox("Shape16", 3F, 3F, -6F, 3, 4, 1);
+ RotatingPart2 = new IHLModelRenderer(this, "RotatingPart2");
+ RotatingPart2.setRotationPoint(-3F, 18F, -7F);
+ setRotation(RotatingPart2, 0F, 0F, 0F);
+ RotatingPart2.mirror = true;
+ RotatingPart2.addTube("PipeN1", -0.5F, -0.5F, 0F, 1, 1, 14, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("PipeN7", -2.5F, -2.5F, -1F, 5, 5, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("PipeN4", -4F, -4F, 2F, 8, 8, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("PipeN14", -4F, -4F, 12F, 8, 8, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("PipeN17", -1F, -1F, 3F, 2, 2, 9, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1 = new IHLModelRenderer(this, "MotorPart1");
+ MotorPart1.setRotationPoint(4.5F, 20.5F, 0F);
+ setRotation(MotorPart1, 0F, 0F, 0F);
+ MotorPart1.mirror = true;
+ MotorPart1.addTube("PipeN41", -1.5F, -1.5F, -8F, 3, 3, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN12", -0.5F, -0.5F, -7F, 1, 1, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN13", -1.5F, -1.5F, -5F, 3, 3, 5, 0F,1F,ForgeDirection.NORTH);
+ MotorPart2 = new IHLModelRenderer(this, "MotorPart2");
+ MotorPart2.setRotationPoint(0F, 16F, 0F);
+ setRotation(MotorPart2, 0F, 0F, 0F);
+ MotorPart2.mirror = true;
+ MotorPart2.addBox("Shape4", 3F, 3F, 0F, 3, 4, 4);
+ MotorPart2.addBox("Shape7", 6F, 3F, -5F, 2, 4, 5);
+ MotorPart2.addBox("Shape10", 1F, 3F, -5F, 2, 4, 5);
+ Belt = new IHLModelRenderer(this, "Belt");
+ Belt.setRotationPoint(-3F, 15.5F, -7.9F);
+ setRotation(Belt, 0F, 0F, 0.45F);
+ Belt.mirror = true;
+ Belt.addBox("Shape12", 0.5F, 0F, 0F, 8, 1, 1);
+ Belt2 = new IHLModelRenderer(this, "Belt2");
+ Belt2.setRotationPoint(-3F, 19.5F, -7.9F);
+ setRotation(Belt2, 0F, 0F, 0.19F);
+ Belt2.mirror = true;
+ Belt2.addBox("Shape13", 0F, 0F, 0F, 8, 1, 1);
+ CoilRotating = new IHLModelRenderer(this, "CoilRotating");
+ CoilRotating.setRotationPoint(-3F, 18F, -7F);
+ setRotation(CoilRotating, 0F, 0F, 0F);
+ CoilRotating.mirror = true;
+ CoilRotating.addTube("PipeN15", -2F, -2F, 3F, 4, 4, 9, 0F,1F,ForgeDirection.NORTH);
+ Coil = new IHLModelRenderer(this, "Coil");
+ Coil.setRotationPoint(-0.25F, 16F, 0F);
+ setRotation(Coil, 0F, 0F, -0.2F);
+ Coil.mirror = true;
+ Coil.addTube("Shape1", -8F, -0.25F, -0.5F, 5, 1, 1, 0F,1F,ForgeDirection.WEST);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/CoilerRender.java b/src/main/java/ihl/processing/metallurgy/CoilerRender.java
new file mode 100644
index 0000000..26ee32f
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/CoilerRender.java
@@ -0,0 +1,80 @@
+package ihl.processing.metallurgy;
+import org.lwjgl.opengl.GL11;
+
+import ic2.api.tile.IWrenchable;
+import ihl.IHLModInfo;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+
+public class CoilerRender extends TileEntitySpecialRenderer{
+private CoilerModel model = new CoilerModel();
+private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png");
+private final float scale=1F/16F;
+
+ public CoilerRender() {}
+
+
+ @Override
+ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par8)
+ {
+ int rotation = 0;
+ if(tile.getWorldObj() != null)
+ {
+ switch (((IWrenchable)tile).getFacing())
+ {
+ case 2:
+ rotation = 0;
+ break;
+ case 5:
+ rotation = 1;
+ break;
+ case 3:
+ rotation = 2;
+ break;
+ case 4:
+ rotation = 3;
+ break;
+ default:
+ rotation = 0;
+ }
+ }
+ else
+ {
+ return;
+ }
+ CoilerTileEntity cte = (CoilerTileEntity)tile;
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
+ GL11.glScalef(1.0F, -1F, -1F);
+ GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F);
+
+ bindTexture(tex);
+ model.Base.render(scale);
+ model.Belt.render(scale);
+ model.Belt2.render(scale);
+ if(cte.getActive())
+ {
+ model.Coil.render(scale);
+ model.CoilRotating.rotateAngleZ+=0.02F;
+ model.CoilRotating.render(scale);
+ model.RotatingPart2.rotateAngleZ+=0.02F;
+ model.MotorPart1.rotateAngleZ+=0.03F;
+ model.MotorPart1.render(scale);
+ model.MotorPart2.render(scale);
+ }
+ else
+ {
+
+ if(cte.hasCoil)
+ {
+ model.CoilRotating.render(scale);
+ }
+ model.MotorPart1.render(scale);
+ model.MotorPart2.render(scale);
+ }
+ model.RotatingPart2.render(scale);
+ GL11.glPopMatrix(); //end
+
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/CoilerTileEntity.java b/src/main/java/ihl/processing/metallurgy/CoilerTileEntity.java
new file mode 100644
index 0000000..3853a0e
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/CoilerTileEntity.java
@@ -0,0 +1,155 @@
+package ihl.processing.metallurgy;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.interfaces.IWire;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+public class CoilerTileEntity extends BasicElectricMotorTileEntity implements IProductionLine{
+
+ public final InvSlotOutput output;
+ private int activeTimer=0;
+ public boolean hasCoil=false;
+
+ public CoilerTileEntity()
+ {
+ super();
+ this.output = new InvSlotOutput(this, "output", 1, 1);
+ }
+
+
+ @Override
+ public String getInventoryName() {
+ return "Coiler";
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = super.getNetworkedFields();
+ fields.add("hasCoil");
+ return fields;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer player)
+ {
+ return IHLUtils.getThisModItemStack("coiler");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new CoilerGui(new CoilerContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player)
+ {
+ return new CoilerContainer(player, this);
+ }
+
+ @Override
+ public boolean canOperate()
+ {
+ return false;
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ if(activeTimer>0)
+ {
+ activeTimer--;
+ }
+ else
+ {
+ setActive(false);
+ }
+ if(this.output.isEmpty() && hasCoil==true)
+ {
+ this.hasCoil=false;
+ IC2.network.get().updateTileEntityField(this, "hasCoil");
+ }
+ else if(!this.output.isEmpty() && hasCoil==false)
+ {
+ this.hasCoil=true;
+ IC2.network.get().updateTileEntityField(this, "hasCoil");
+ }
+ }
+
+ @Override
+ public void operate()
+ {}
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public List[] getInput()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean canProcess(ItemStack cable) {
+ if(this.energy>1D && cable.getItem() instanceof IWire)
+ {
+ if(this.output.isEmpty())
+ {
+ return true;
+ }
+ else if(this.output.get().getItem() instanceof IWire)
+ {
+ return ((IWire)this.output.get().getItem()).isSameWire(this.output.get(), cable);
+ }
+ else
+ {
+ return this.output.get().isItemEqual(cable);
+ }
+ }
+ return false;
+ }
+
+
+ @Override
+ public void process(ItemStack cable) {
+ if(cable.getItem() instanceof IWire)
+ {
+ this.energy-=1D;
+ if(this.output.isEmpty())
+ {
+ setActive(true);
+ activeTimer=800;
+ this.output.put(cable);
+ this.hasCoil=true;
+ IC2.network.get().updateTileEntityField(this, "hasCoil");
+ }
+ else
+ {
+ setActive(true);
+ activeTimer=800;
+ int length = this.output.get().stackTagCompound.getInteger(((IWire)this.output.get().getItem()).getTag());
+ int fullLength = this.output.get().stackTagCompound.getInteger(((IWire)this.output.get().getItem()).getTagSecondary());
+ int lengthToAdd = cable.stackTagCompound.getInteger(((IWire)cable.getItem()).getTag());
+ int fullLengthToAdd = cable.stackTagCompound.getInteger(((IWire)cable.getItem()).getTagSecondary());
+ this.output.get().stackTagCompound.setInteger(((IWire)this.output.get().getItem()).getTag(), length+lengthToAdd);
+ this.output.get().stackTagCompound.setInteger(((IWire)this.output.get().getItem()).getTagSecondary(),fullLength+fullLengthToAdd);
+ }
+ }
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/Crucible.java b/src/main/java/ihl/processing/metallurgy/Crucible.java
new file mode 100644
index 0000000..220b505
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/Crucible.java
@@ -0,0 +1,366 @@
+package ihl.processing.metallurgy;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.item.IItemHudInfo;
+import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputOreDict;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.item.IHandHeldInventory;
+import ic2.core.util.LiquidUtil;
+import ic2.core.util.StackUtil;
+import ihl.IHLCreativeTab;
+import ihl.IHLModInfo;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidContainerItem;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class Crucible extends Item implements IHandHeldInventory, IFluidContainerItem, IItemHudInfo{
+
+ public int capacity=864;
+ private String itemName;
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("crucible");
+
+ @SideOnly(Side.CLIENT)
+ private IIcon iconHot;
+
+ public Crucible() {
+ super();
+ this.itemName="crucible";
+ this.setUnlocalizedName(itemName);
+ GameRegistry.registerItem(this, this.itemName);
+ this.setCreativeTab(IHLCreativeTab.tab);
+ this.maxStackSize=1;
+ this.setCreativeTab(IHLCreativeTab.tab);
+ this.setMaxDamage(0);
+ }
+
+ public static void addRecipe(String string, FluidStack output)
+ {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, new IRecipeInput[] {new RecipeInputOreDict(string)}), new UniversalRecipeOutput(new FluidStack[] {output},null,20));
+ }
+
+ @Override
+ public IHasGui getInventory(EntityPlayer entityPlayer, ItemStack itemStack)
+ {
+ return new CrucibleInventory(entityPlayer, itemStack);
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
+ {
+ if (IC2.platform.isSimulating())
+ {
+ IC2.platform.launchGui(entityPlayer, this.getInventory(entityPlayer, itemStack));
+ }
+ return itemStack;
+ }
+
+ /**
+ * allows items to add custom lines of information to the mouseover description
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean b)
+ {
+ super.addInformation(itemStack, player, info, b);
+ FluidStack fs = this.getFluid(itemStack);
+
+ if (fs != null)
+ {
+ info.add("< " + FluidRegistry.getFluidName(fs) + ", " + fs.amount + " mB >");
+ }
+ else
+ {
+ info.add(StatCollector.translateToLocal("ic2.item.FluidContainer.Empty"));
+ }
+ }
+
+ @Override
+ public List<String> getHudInfo(ItemStack itemStack)
+ {
+ LinkedList<String> info = new LinkedList<String>();
+ FluidStack fs = this.getFluid(itemStack);
+
+ if (fs != null)
+ {
+ info.add("< " + FluidRegistry.getFluidName(fs) + ", " + fs.amount + " mB >");
+ }
+ else
+ {
+ info.add(StatCollector.translateToLocal("ic2.item.FluidContainer.Empty"));
+ }
+
+ return info;
+ }
+
+ @Override
+ public FluidStack getFluid(ItemStack stack)
+ {
+ NBTTagCompound nbtTagCompound = StackUtil.getOrCreateNbtData(stack);
+ NBTTagCompound fluidTag = nbtTagCompound.getCompoundTag("Fluid");
+ return FluidStack.loadFluidStackFromNBT(fluidTag);
+ }
+
+ public boolean isEmpty(ItemStack stack)
+ {
+ return this.getFluid(stack) == null;
+ }
+
+ @Override
+ public int getCapacity(ItemStack container)
+ {
+ return this.capacity;
+ }
+
+ public boolean canfill(Fluid var1)
+ {
+ return true;
+ }
+
+ public ItemStack processContent(ItemStack itemStack, IInventory inventoryContainer)
+ {
+ CrucibleInventory inventory = new CrucibleInventory(inventoryContainer, itemStack);
+ ItemStack content = inventory.getStackInSlot(0);
+ if(content!=null)
+ {
+ UniversalRecipeOutput routput = recipeManager.getOutputFor(null, Arrays.asList(new ItemStack [] {content}));
+ if(routput!=null && !routput.getFluidOutputs().isEmpty())
+ {
+ FluidStack fluidStack = routput.getFluidOutputs().get(0).copy();
+ fluidStack.amount *= content.stackSize;
+ itemStack.stackTagCompound = new NBTTagCompound();
+ this.fill(itemStack, fluidStack, true);
+ return itemStack;
+ }
+ }
+ return itemStack;
+ }
+
+ @Override
+ public int fill(ItemStack stack, FluidStack resource, boolean doFill)
+ {
+ if (stack.stackSize != 1)
+ {
+ return 0;
+ }
+ else if (resource == null)
+ {
+ return 0;
+ }
+ else if (!this.canfill(resource.getFluid()))
+ {
+ return 0;
+ }
+ else
+ {
+ NBTTagCompound nbtTagCompound = StackUtil.getOrCreateNbtData(stack);
+ NBTTagCompound fluidTag = nbtTagCompound.getCompoundTag("Fluid");
+ FluidStack fs = FluidStack.loadFluidStackFromNBT(fluidTag);
+
+ if (fs == null)
+ {
+ fs = new FluidStack(resource, 0);
+ }
+
+ if (!fs.isFluidEqual(resource))
+ {
+ return 0;
+ }
+ else
+ {
+ int amount = Math.min(this.capacity - fs.amount, resource.amount);
+
+ if (doFill && amount > 0)
+ {
+ fs.amount += amount;
+ fs.writeToNBT(fluidTag);
+ nbtTagCompound.setTag("Fluid", fluidTag);
+ if(fs.getFluid().getTemperature()>900)stack.setItemDamage(1);
+ }
+
+ return amount;
+ }
+ }
+ }
+
+ @Override
+ public FluidStack drain(ItemStack stack, int maxDrain, boolean doDrain)
+ {
+ if (stack.stackSize != 1)
+ {
+ return null;
+ }
+ else
+ {
+ NBTTagCompound nbtTagCompound = StackUtil.getOrCreateNbtData(stack);
+ NBTTagCompound fluidTag = nbtTagCompound.getCompoundTag("Fluid");
+ FluidStack fs = FluidStack.loadFluidStackFromNBT(fluidTag);
+
+ if (fs == null)
+ {
+ return null;
+ }
+ else
+ {
+ maxDrain = Math.min(fs.amount, maxDrain);
+
+ if (doDrain)
+ {
+ fs.amount -= maxDrain;
+
+ if (fs.amount <= 0)
+ {
+ nbtTagCompound.removeTag("Fluid");
+ stack.setItemDamage(0);
+ }
+ else
+ {
+ fs.writeToNBT(fluidTag);
+ nbtTagCompound.setTag("Fluid", fluidTag);
+ }
+ }
+
+ return new FluidStack(fs, maxDrain);
+ }
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ itemIcon=register.registerIcon(IHLModInfo.MODID + ":crucible");
+ iconHot=register.registerIcon(IHLModInfo.MODID + ":crucibleHot");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int meta)
+ {
+ switch(meta)
+ {
+ case 0:
+ return this.itemIcon;
+ case 1:
+ return this.iconHot;
+ default:
+ return this.itemIcon;
+ }
+ }
+
+ @Override
+ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset)
+ {
+ if (!IC2.platform.isSimulating())
+ {
+ return false;
+ }
+ else if (this.interactWithTank(stack, player, world, x, y, z, side))
+ {
+ return true;
+ }
+ return false;
+ }
+
+
+ private boolean interactWithTank(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side)
+ {
+ if (!IC2.platform.isSimulating())
+ {
+ return false;
+ }
+ else
+ {
+ TileEntity te = world.getTileEntity(x, y, z);
+
+ if (!(te instanceof IFluidHandler))
+ {
+ return false;
+ }
+ else
+ {
+ IFluidHandler handler = (IFluidHandler)te;
+ ForgeDirection dir = ForgeDirection.getOrientation(side);
+ FluidStack fs = this.getFluid(stack);
+ int amount;
+
+ if (fs != null && (!player.isSneaking() || fs.amount >= this.capacity))
+ {
+ amount = handler.fill(dir, fs, false);
+
+ if (amount <= 0)
+ {
+ return false;
+ }
+ else
+ {
+ fs = LiquidUtil.drainContainerStack(stack, player, amount, false);
+
+ if (fs != null && fs.amount > 0)
+ {
+ handler.fill(dir, fs, true);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ amount = fs == null ? this.capacity : this.capacity - fs.amount;
+ FluidStack input = handler.drain(dir, amount, false);
+
+ if (input != null && input.amount > 0)
+ {
+ amount = LiquidUtil.fillContainerStack(stack, player, input, false);
+
+ if (amount <= 0)
+ {
+ return false;
+ }
+ else
+ {
+ handler.drain(dir, amount, true);
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+ }
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/CrucibleContainer.java b/src/main/java/ihl/processing/metallurgy/CrucibleContainer.java
new file mode 100644
index 0000000..20ec65e
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/CrucibleContainer.java
@@ -0,0 +1,66 @@
+package ihl.processing.metallurgy;
+
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.util.StackUtil;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class CrucibleContainer extends ContainerBase<CrucibleInventory>
+{
+ public CrucibleInventory box;
+ public CrucibleContainer(EntityPlayer entityPlayer, CrucibleInventory box)
+ {
+ super(box);
+ this.box = box;
+ int col;
+ if(((Crucible)this.box.thisItemStack.getItem()).isEmpty(this.box.thisItemStack))
+ {
+ this.addSlotToContainer(new CrucibleSlot(this.box, 0, 81, 42));
+ }
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, 84 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, 142));
+ }
+ }
+
+ @Override
+ public ItemStack slotClick(int slot, int button, int par3, EntityPlayer player)
+ {
+ if (player instanceof EntityPlayerMP && IC2.platform.isSimulating() && slot == -999 && (button == 0 || button == 1))
+ {
+ ItemStack stack = player.inventory.getItemStack();
+
+ if (stack != null)
+ {
+ StackUtil.getOrCreateNbtData(stack);
+
+ if (this.box.isThisContainer(stack))
+ {
+ ((EntityPlayerMP)player).closeScreen();
+ }
+ }
+ }
+ return super.slotClick(slot, button, par3, player);
+ }
+
+ /**
+ * Called when the container is closed.
+ */
+ @Override
+ public void onContainerClosed(EntityPlayer entityPlayer)
+ {
+ this.box.onGuiClosed(entityPlayer);
+ super.onContainerClosed(entityPlayer);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/CrucibleGui.java b/src/main/java/ihl/processing/metallurgy/CrucibleGui.java
new file mode 100644
index 0000000..f05e7bb
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/CrucibleGui.java
@@ -0,0 +1,84 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import ic2.core.util.DrawUtil;
+import ic2.core.util.GuiTooltipHelper;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public class CrucibleGui extends GuiContainer
+{
+ public CrucibleContainer container;
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUICrucible.png");
+ private static final String title = StatCollector.translateToLocal("item.crucible.name");
+
+ public CrucibleGui(CrucibleContainer container1)
+ {
+ super(container1);
+ this.container = container1;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString(title, 68, 0, 6171880);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.mc.renderEngine.bindTexture(background);
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ if(this.getItemStack().getItemDamage()==1)
+ {
+ this.drawTexturedModalRect(x+67, y+26, 198, 52, 58, 39);
+ }
+ FluidStack fluidStack = this.getItemInstance().getFluid(this.getItemStack());
+ if (fluidStack!=null && fluidStack.amount > 0)
+ {
+ Fluid fluid = fluidStack.getFluid();
+ if(fluid!=null)
+ {
+ IIcon fluidIcon = fluid.getIcon();
+ if (fluidIcon != null)
+ {
+ this.mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
+ int liquidHeight = fluidStack.amount*20/getItemInstance().capacity;
+ DrawUtil.drawRepeated(fluidIcon, x+71, y+ 41 + 20 - liquidHeight, 35.0D, liquidHeight, this.zLevel);
+ }
+ }
+ String tooltip = StatCollector.translateToLocal(fluidStack.getFluid().getName()) + ": " + fluidStack.amount + "mB";
+ GuiTooltipHelper.drawAreaTooltip(par2, par3, tooltip, x-16, y+10, x+16, y+29);
+ }
+ this.mc.renderEngine.bindTexture(background);
+ if(this.getItemStack().getItemDamage()==1)
+ {
+ this.drawTexturedModalRect(x+68, y+40, 198, 26, 58, 26);
+ }
+ else
+ {
+ this.drawTexturedModalRect(x+68, y+40, 198, 0, 58, 26);
+ }
+ }
+
+ private Crucible getItemInstance()
+ {
+ return ((Crucible)this.container.box.thisItemStack.getItem());
+ }
+
+ private ItemStack getItemStack()
+ {
+ return this.container.box.thisItemStack;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/CrucibleInventory.java b/src/main/java/ihl/processing/metallurgy/CrucibleInventory.java
new file mode 100644
index 0000000..253483f
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/CrucibleInventory.java
@@ -0,0 +1,126 @@
+package ihl.processing.metallurgy;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.item.tool.HandHeldInventory;
+import ic2.core.util.StackUtil;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+public class CrucibleInventory extends HandHeldInventory {
+
+ ItemStack thisItemStack;
+ IInventory inventoryContainer;
+
+ public CrucibleInventory(EntityPlayer player, ItemStack stack) {
+ super(player, stack, 1);
+ thisItemStack = stack;
+ inventoryContainer = player.inventory;
+ }
+
+ public CrucibleInventory(IInventory inventoryContainer1, ItemStack stack) {
+ super(null, stack, 1);
+ thisItemStack = stack;
+ inventoryContainer = inventoryContainer1;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new CrucibleGui(new CrucibleContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new CrucibleContainer(player, this);
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "crucible";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int arg0, ItemStack stack) {
+ return true;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 6;
+ }
+
+ @Override
+ public void save() {
+ if (IC2.platform.isSimulating()) {
+ NBTTagCompound nbtTagCompound = StackUtil.getOrCreateNbtData(this.thisItemStack);
+
+ for (int nbtTagList = 0; nbtTagList < this.getSizeInventory(); ++nbtTagList) {
+ if (this.inventory[nbtTagList] != null) {
+ NBTTagCompound i = StackUtil.getOrCreateNbtData(this.inventory[nbtTagList]);
+
+ if (nbtTagCompound.getInteger("uid") == i.getInteger("uid")) {
+ this.thisItemStack.stackSize = 1;
+ this.inventory[nbtTagList] = null;
+ break;
+ }
+ }
+ }
+
+ NBTTagList var7 = new NBTTagList();
+ int var8;
+
+ for (var8 = 0; var8 < this.inventory.length; ++var8) {
+ if (this.inventory[var8] != null) {
+ NBTTagCompound itemStackSlot = new NBTTagCompound();
+ itemStackSlot.setByte("Slot", (byte) var8);
+ this.inventory[var8].writeToNBT(itemStackSlot);
+ var7.appendTag(itemStackSlot);
+ }
+ }
+
+ nbtTagCompound.setTag("Items", var7);
+
+ for (var8 = -1; var8 < inventoryContainer.getSizeInventory(); ++var8) {
+ ItemStack var9 = null;
+
+ if (var8 == -1 && inventoryContainer instanceof InventoryPlayer) {
+ var9 = ((InventoryPlayer) inventoryContainer).getItemStack();
+ } else if (var8 >= 0) {
+ var9 = inventoryContainer.getStackInSlot(var8);
+ }
+
+ if (var9 != null) {
+ NBTTagCompound nbtTagCompoundSlot = var9.getTagCompound();
+
+ if (nbtTagCompoundSlot != null
+ && nbtTagCompound.getInteger("uid") == nbtTagCompoundSlot.getInteger("uid")) {
+ this.thisItemStack.stackSize = 1;
+
+ if (var8 == -1 && inventoryContainer instanceof InventoryPlayer) {
+ ((InventoryPlayer) inventoryContainer).setItemStack(this.thisItemStack);
+ } else {
+ inventoryContainer.setInventorySlotContents(var8, this.thisItemStack);
+ }
+
+ break;
+ }
+ }
+ }
+
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/CrucibleSlot.java b/src/main/java/ihl/processing/metallurgy/CrucibleSlot.java
new file mode 100644
index 0000000..5fc6a33
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/CrucibleSlot.java
@@ -0,0 +1,18 @@
+package ihl.processing.metallurgy;
+
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class CrucibleSlot extends Slot {
+ CrucibleInventory inventory;
+
+ public CrucibleSlot(CrucibleInventory arg0, int arg1, int arg2, int arg3) {
+ super(arg0, arg1, arg2, arg3);
+ inventory = arg0;
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack itemstack) {
+ return itemstack != null;
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineContainer.java b/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineContainer.java
new file mode 100644
index 0000000..94d479c
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineContainer.java
@@ -0,0 +1,39 @@
+package ihl.processing.metallurgy;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Slot;
+
+public class DetonationSprayingMachineContainer extends ContainerBase<DetonationSprayingMachineTileEntity> {
+
+ protected DetonationSprayingMachineTileEntity tileEntity;
+ public int lastFluidAmount = -1;
+ public short lastProgress = -1;
+ private final static int height=166;
+
+ public DetonationSprayingMachineContainer(EntityPlayer entityPlayer, DetonationSprayingMachineTileEntity detonationSprayingMachineTileEntity){
+ super(detonationSprayingMachineTileEntity);
+ this.tileEntity = detonationSprayingMachineTileEntity;
+ int col;
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(detonationSprayingMachineTileEntity.input, 0, 10, 17));
+ this.addSlotToContainer(new SlotInvSlot(detonationSprayingMachineTileEntity.input, 1, 98, 17));
+ this.addSlotToContainer(new SlotInvSlot(detonationSprayingMachineTileEntity.input, 2, 117, 17));
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineGui.java b/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineGui.java
new file mode 100644
index 0000000..8cd29d0
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineGui.java
@@ -0,0 +1,48 @@
+package ihl.processing.metallurgy;
+
+import java.util.Iterator;
+
+import org.lwjgl.opengl.GL11;
+
+import codechicken.lib.gui.GuiDraw;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+
+@SideOnly(Side.CLIENT)
+public class DetonationSprayingMachineGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIDetonationSprayingMachine.png");
+ private static final String hint = StatCollector.translateToLocal("ihl.dsmhint");
+
+ public DetonationSprayingMachineGui (DetonationSprayingMachineContainer detonationSprayingMachineContainer) {
+ //the container is instanciated and passed to the superclass for handling
+ super(detonationSprayingMachineContainer);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ Iterator<String> noteListIterator = this.mc.fontRenderer.listFormattedStringToWidth(hint, 140).iterator();
+ int yTextPos=40;
+ while(noteListIterator.hasNext())
+ {
+ GuiDraw.fontRenderer.drawStringWithShadow(noteListIterator.next(), x+15, y+yTextPos, 16777215);
+ yTextPos+=10;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineModel.java b/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineModel.java
new file mode 100644
index 0000000..7335125
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineModel.java
@@ -0,0 +1,57 @@
+package ihl.processing.metallurgy;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.entity.Entity;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class DetonationSprayingMachineModel extends ModelBase {
+ //fields
+ IHLModelRenderer Base;
+
+ public DetonationSprayingMachineModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape1", 20, 0);
+ setTextureOffset("Base.Shape2", 34, 0);
+ setTextureOffset("Base.Shape3", 23, 0);
+ setTextureOffset("Base.Shape4", 23, 0);
+ setTextureOffset("Base.Shape5", 0, 0);
+ setTextureOffset("Base.Tube1", 0, 0);
+ setTextureOffset("Base.Tube2", 0, 0);
+ setTextureOffset("Base.Shape12", 0, 20);
+ setTextureOffset("Base.Shape13", 0, 20);
+ setTextureOffset("Base.Shape14", 0, 20);
+ setTextureOffset("Base.Shape7", 26, 22);
+ setTextureOffset("Base.Shape8", 18, 19);
+ setTextureOffset("Base.Shape9", 18, 22);
+ setTextureOffset("Base.Tube11", 8, 5);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 8F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape1", 4F, 6F, 7F, 2, 9, 1, false);
+ Base.addBox("Shape2", -7F, 4F, 6F, 14, 11, 1, false);
+ Base.addBox("Shape3", -1F, 6F, 7F, 2, 9, 1, false);
+ Base.addBox("Shape4", -6F, 6F, 7F, 2, 9, 1, false);
+ Base.addBox("Shape5", -8F, 15F, -8F, 16, 1, 16, false);
+ Base.addTube("Tube1", -1F, 10F, -7F, 2, 2, 6, 0.5F,1F,ForgeDirection.NORTH);
+ Base.addTube("Tube2", -2.5F, 10.5F, -6F, 5, 1, 1, 0F,1F,ForgeDirection.EAST);
+ Base.addBox("Shape12", -2.5F, 11.7F, -2.2F, 5, 4, 1, false);
+ Base.addBox("Shape13", 1F, 9F, -8F, 1, 6, 6, false);
+ Base.addBox("Shape14", -2F, 9F, -8F, 1, 6, 6, false);
+ Base.addBox("Shape7", -1F, 14F, -8F, 2, 1, 5, false);
+ Base.addBox("Shape8", 2F, 14F, -8F, 2, 1, 9, false);
+ Base.addBox("Shape9", -4F, 14F, -8F, 2, 1, 9, false);
+ Base.addTube("Tube11", -1F, 10F, -8F, 2, 2, 1, 0F,1F,ForgeDirection.NORTH);
+ }
+
+ @Override
+ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
+ {
+ super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
+ }
+}
+
+
diff --git a/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineRender.java b/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineRender.java
new file mode 100644
index 0000000..b68f8b3
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineRender.java
@@ -0,0 +1,61 @@
+package ihl.processing.metallurgy;
+import org.lwjgl.opengl.GL11;
+
+import ic2.api.tile.IWrenchable;
+import ihl.IHLModInfo;
+import ihl.utils.IHLItemRenderer;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+
+public class DetonationSprayingMachineRender extends TileEntitySpecialRenderer{
+private DetonationSprayingMachineModel model = new DetonationSprayingMachineModel();
+private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/detonationSprayingMachine.png");
+private final float scale=1F/16F;
+private IHLItemRenderer itemRenderer=new IHLItemRenderer(true);
+
+public DetonationSprayingMachineRender(){}
+
+public void renderAModelAt(DetonationSprayingMachineTileEntity tile, double x, double y, double z, float f) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)x + 0.5F, (float)y+0.5F, (float)z + 0.5F);
+ int rotation = 0;
+ if(tile.getWorldObj() != null)
+ {
+ switch (((IWrenchable)tile).getFacing())
+ {
+ case 2:
+ rotation = 0;
+ break;
+ case 5:
+ rotation = 1;
+ break;
+ case 3:
+ rotation = 2;
+ break;
+ case 4:
+ rotation = 3;
+ break;
+ default:
+ rotation = 0;
+ }
+ }
+ GL11.glRotatef(-rotation*90f, 0F, 1F, 0F);
+ if(tile.input.get()!=null)
+ {
+ this.itemRenderer.doRender(RenderManager.instance,tile.input.get(),0F,-0.2F,-0.35F);
+ }
+ bindTexture(tex); //texture
+ GL11.glScalef(1F, -1F, -1F);
+ GL11.glTranslatef(0F, -1.0F, 0F);
+ model.Base.render(scale);
+ GL11.glPopMatrix();
+}
+
+ @Override
+ public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
+ {
+ this.renderAModelAt((DetonationSprayingMachineTileEntity)par1TileEntity, par2, par4, par6, par8);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java b/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java
new file mode 100644
index 0000000..411b8db
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/DetonationSprayingMachineTileEntity.java
@@ -0,0 +1,198 @@
+package ihl.processing.metallurgy;
+
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.network.INetworkTileEntityEventListener;
+import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputItemStack;
+import ic2.api.recipe.RecipeInputOreDict;
+import ic2.core.ContainerBase;
+import ic2.core.ExplosionIC2;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.audio.AudioSource;
+import ic2.core.audio.PositionSpec;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot.Access;
+import ihl.processing.chemistry.ApparatusProcessableInvSlot;
+import ihl.recipes.RecipeOutputItemStack;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class DetonationSprayingMachineTileEntity extends TileEntityInventory implements IHasGui, INetworkTileEntityEventListener
+{
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("detonationsprayingmachine");
+ public final ApparatusProcessableInvSlot input;
+ private AudioSource explosion;
+
+ public DetonationSprayingMachineTileEntity() {
+ super();
+ this.input = new ApparatusProcessableInvSlot(this, "input", 0, Access.IO, 3, 64);
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = super.getNetworkedFields();
+ return fields;
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return false;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("cannonBronze");
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "detonationSprayingMachine";
+ }
+
+ @Override
+ public void onNetworkEvent(int event)
+ {
+ worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.explode", 4.0F, 1.0F);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new DetonationSprayingMachineGui(new DetonationSprayingMachineContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new DetonationSprayingMachineContainer(player, this);
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer player) {}
+
+ public boolean canOperate()
+ {
+ return getOutput()!=null;
+ }
+
+ public UniversalRecipeOutput getOutput()
+ {
+ return DetonationSprayingMachineTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ public List<?>[] getInput()
+ {
+ return new List[] {null,this.input.getItemStackList()};
+ }
+
+ @Override
+ public void onLoaded()
+ {
+ super.onLoaded();
+ if (IC2.platform.isRendering() && this.explosion==null)
+ {
+ this.explosion = IC2.audioManager.createSource(this, PositionSpec.Center, "Machines/MinerOp.ogg",false,false, 0.5F);
+ }
+ }
+
+
+ public void operate()
+ {//diamond file max durability - 128000
+ //file tags - "GT.ToolStats"->"MaxDamage" & "Damage"
+ if(this.canOperate())
+ {
+ List<IRecipeInput> input1 = DetonationSprayingMachineTileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs();
+ List<RecipeOutputItemStack> output1 = DetonationSprayingMachineTileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
+ ItemStack resultStack = output1.get(0).itemStack.copy();
+ resultStack.stackSize=this.input.get(0).stackSize;
+ if(resultStack.stackTagCompound==null)
+ {
+ resultStack.stackTagCompound=this.input.get(0).stackTagCompound;
+ }
+ if(resultStack.stackTagCompound!=null && resultStack.stackTagCompound.hasKey("GT.ToolStats"))
+ {
+ NBTTagCompound gtTagCompound = resultStack.stackTagCompound.getCompoundTag("GT.ToolStats");
+ if(gtTagCompound!=null && gtTagCompound.hasKey("MaxDamage"))
+ {
+ int maxDamage = gtTagCompound.getInteger("MaxDamage");
+ int damage = 0;
+ if(gtTagCompound.hasKey("Damage"))
+ {
+ damage = gtTagCompound.getInteger("Damage");
+ }
+ if(damage<maxDamage-400)
+ {
+ damage+=400;
+ if(maxDamage<128000)
+ {
+ int dd = (128000-maxDamage)*3/4;
+ maxDamage+=dd;
+ }
+ gtTagCompound.setInteger("Damage",damage);
+ gtTagCompound.setInteger("MaxDamage",maxDamage);
+ resultStack.stackTagCompound.setTag("GT.ToolStats", gtTagCompound);
+ }
+ else
+ {
+ resultStack=null;
+ }
+ }
+ }
+ for(IRecipeInput stack:input1){
+ this.input.consume(stack);
+ }
+ this.input.put(0,resultStack);
+ ExplosionIC2 explosion = new ExplosionIC2(worldObj, null, this.xCoord+0.5D, this.yCoord+0.5D, this.zCoord+0.5D, 0.5F, 0.3F, ExplosionIC2.Type.Normal, null, 0);
+ explosion.doExplosion();
+ IC2.network.get().initiateTileEntityEvent(this, 0, true);
+ }
+ }
+
+ public static void addRecipe(ItemStack input, ItemStack output)
+ {
+ IRecipeInput[] dsmInputs1 = new IRecipeInput[3];
+ dsmInputs1[0]=new RecipeInputItemStack(input);
+ dsmInputs1[1]=new RecipeInputOreDict("dustDiamond");
+ dsmInputs1[2]=new RecipeInputOreDict("dustGunpowder");
+ recipeManager.addRecipe(new UniversalRecipeInput(null, dsmInputs1), new UniversalRecipeOutput(null,new ItemStack[] {output},1));
+ }
+
+ public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output)
+ {
+ recipeManager.addRecipe(input, output);
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/ElectricEngineItem.java b/src/main/java/ihl/processing/metallurgy/ElectricEngineItem.java
new file mode 100644
index 0000000..c1e0003
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/ElectricEngineItem.java
@@ -0,0 +1,84 @@
+package ihl.processing.metallurgy;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.IHLCreativeTab;
+import ihl.IHLModInfo;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.Item;
+import net.minecraft.util.IIcon;
+
+public class ElectricEngineItem extends Item{
+
+ public Type type;
+ public static List<ElectricEngineItem> instances = new ArrayList<ElectricEngineItem> ();
+ private static Map<Type, IIcon> iconMap = new HashMap<Type, IIcon>();
+
+
+ public ElectricEngineItem(Type type1)
+ {
+ super();
+ this.type=type1;
+ this.setCreativeTab(IHLCreativeTab.tab);
+ this.setUnlocalizedName(type.unLocalizedName);
+ this.setMaxStackSize(1);
+ instances.add(this);
+ }
+
+ public static void init()
+ {
+ Type[] var1 = Type.values();
+ for(int i=0;i<var1.length;i++)
+ {
+ new ElectricEngineItem(var1[i]);
+ }
+ Iterator<ElectricEngineItem> ii = instances.iterator();
+ while(ii.hasNext())
+ {
+ ElectricEngineItem instance = ii.next();
+ GameRegistry.registerItem(instance,instance.type.unLocalizedName);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register)
+ {
+ iconMap.put(this.type, register.registerIcon(IHLModInfo.MODID + ":"+this.type.unLocalizedName));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int i)
+ {
+ return iconMap.get(type);
+ }
+
+
+ public enum Type
+ {
+ LVLEElectricEngine("electricMotorLVLEDC", 600,400,0.2F,1500);
+ Type(String unlocalizedName1, int maxVoltage1, int generatedVoltage1, float efficiency1,int rpm1)
+ {
+ unLocalizedName=unlocalizedName1;
+ maxVoltage=maxVoltage1;
+ generatedVoltage=generatedVoltage1;
+ efficiency=efficiency1;
+ rpm=rpm1;
+ }
+
+ public String unLocalizedName;
+ public int maxVoltage=600;
+ public int generatedVoltage=400;
+ public float efficiency = 0.2F;
+ public int rpm=1500;//at max voltage
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/ExtruderContainer.java b/src/main/java/ihl/processing/metallurgy/ExtruderContainer.java
new file mode 100644
index 0000000..77b92e6
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/ExtruderContainer.java
@@ -0,0 +1,75 @@
+package ihl.processing.metallurgy;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class ExtruderContainer extends ContainerBase<ExtruderTileEntity> {
+
+ public ExtruderTileEntity tileEntity;
+ public int lastProgress = -1;
+ private short lastEnergy = -1;
+ private final static int height=166;
+
+ public ExtruderContainer(EntityPlayer entityPlayer,
+ ExtruderTileEntity lathePart1TileEntity) {
+ super(lathePart1TileEntity);
+ tileEntity=lathePart1TileEntity;
+ int col;
+
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.input, 0, 39, 32));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.input2, 0, 57, 32));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.dischargeSlot,0, 8, 32));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ if (this.tileEntity.progress != this.lastProgress)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+ if (this.tileEntity.getEnergy() != this.lastEnergy)
+ {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getEnergy());
+ }
+ }
+ this.lastProgress = this.tileEntity.progress;
+ this.lastEnergy = (short) this.tileEntity.getEnergy();
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+
+ switch (index)
+ {
+ case 0:
+ this.tileEntity.progress=(short) value;
+ break;
+ case 1:
+ this.tileEntity.setEnergy(value);
+ break;
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/ExtruderGui.java b/src/main/java/ihl/processing/metallurgy/ExtruderGui.java
new file mode 100644
index 0000000..acf1a76
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/ExtruderGui.java
@@ -0,0 +1,49 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+public class ExtruderGui extends GuiContainer {
+
+ private ExtruderContainer container;
+ protected static final ResourceLocation tex = new ResourceLocation("ihl", "textures/gui/GUIExtruder.png");
+
+ public ExtruderGui(ExtruderContainer latheContainer) {
+ super(latheContainer);
+ container = latheContainer;
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(9, 15 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(18),18);
+ this.drawTexturedModalRect(74, 34, 198, 0, i1 + 1, 13);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/ExtruderModel.java b/src/main/java/ihl/processing/metallurgy/ExtruderModel.java
new file mode 100644
index 0000000..fcff405
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/ExtruderModel.java
@@ -0,0 +1,100 @@
+package ihl.processing.metallurgy;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class ExtruderModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+ IHLModelRenderer RotatingPart2;
+ IHLModelRenderer MotorPart1;
+ IHLModelRenderer MotorPart2;
+ IHLModelRenderer Belt;
+ IHLModelRenderer Belt2;
+ IHLModelRenderer Extruder;
+
+ public ExtruderModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 0);
+ setTextureOffset("Base.Shape3", 0, 0);
+ setTextureOffset("Base.Shape16", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN7", 49, 23);
+ setTextureOffset("RotatingPart2.PipeN4", 0, 7);
+ setTextureOffset("MotorPart1.PipeN41", 0, 0);
+ setTextureOffset("MotorPart1.PipeN12", 0, 0);
+ setTextureOffset("MotorPart1.PipeN13", 0, 0);
+ setTextureOffset("MotorPart2.Shape4", 0, 24);
+ setTextureOffset("MotorPart2.Shape7", 0, 9);
+ setTextureOffset("MotorPart2.Shape10", 0, 9);
+ setTextureOffset("Belt.Shape12", 0, 0);
+ setTextureOffset("Belt2.Shape13", 0, 0);
+ setTextureOffset("Extruder.PipeN16", 0, 0);
+ setTextureOffset("Extruder.PipeN15", 24, 20);
+ setTextureOffset("Extruder.Shape8", 0, 0);
+ setTextureOffset("Extruder.PipeU17", 0, 0);
+ setTextureOffset("Extruder.PipeUC18", 0, 0);
+ setTextureOffset("Extruder.Shape14", 0, 0);
+ setTextureOffset("Extruder.PipeN14", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, -8F, 16, 1, 16);
+ Base.addBox("Shape3", -5F, 0F, -7F, 4, 7, 1);
+ Base.addBox("Shape16", 3F, 3F, -6F, 3, 4, 1);
+ RotatingPart2 = new IHLModelRenderer(this, "RotatingPart2");
+ RotatingPart2.setRotationPoint(-3F, 18F, -7F);
+ setRotation(RotatingPart2, 0F, 0F, 0F);
+ RotatingPart2.mirror = true;
+ RotatingPart2.addTube("PipeN7", -2.5F, -2.5F, -1F, 5, 5, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("PipeN4", -1F, -1F, 1F, 2, 2, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1 = new IHLModelRenderer(this, "MotorPart1");
+ MotorPart1.setRotationPoint(4.5F, 20.5F, 0F);
+ setRotation(MotorPart1, 0F, 0F, 0F);
+ MotorPart1.mirror = true;
+ MotorPart1.addTube("PipeN41", -1.5F, -1.5F, -8F, 3, 3, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN12", -0.5F, -0.5F, -7F, 1, 1, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN13", -1.5F, -1.5F, -5F, 3, 3, 5, 0F,1F,ForgeDirection.NORTH);
+ MotorPart2 = new IHLModelRenderer(this, "MotorPart2");
+ MotorPart2.setRotationPoint(0F, 16F, 0F);
+ setRotation(MotorPart2, 0F, 0F, 0F);
+ MotorPart2.mirror = true;
+ MotorPart2.addBox("Shape4", 3F, 3F, 0F, 3, 4, 4);
+ MotorPart2.addBox("Shape7", 6F, 3F, -5F, 2, 4, 5);
+ MotorPart2.addBox("Shape10", 1F, 3F, -5F, 2, 4, 5);
+ Belt = new IHLModelRenderer(this, "Belt");
+ Belt.setRotationPoint(-3F, 15.5F, -7.9F);
+ setRotation(Belt, 0F, 0F, 0.45F);
+ Belt.mirror = true;
+ Belt.addBox("Shape12", 0.5F, 0F, 0F, 8, 1, 1);
+ Belt2 = new IHLModelRenderer(this, "Belt2");
+ Belt2.setRotationPoint(-3F, 19.5F, -7.9F);
+ setRotation(Belt2, 0F, 0F, 0.19F);
+ Belt2.mirror = true;
+ Belt2.addBox("Shape13", 0F, 0F, 0F, 8, 1, 1);
+ Extruder = new IHLModelRenderer(this, "Extruder");
+ Extruder.setRotationPoint(0F, 16F, 0F);
+ setRotation(Extruder, 0F, 0F, 0F);
+ Extruder.mirror = true;
+ Extruder.addTube("PipeN16", -4.5F, 0.5F, -5F, 3, 3, 12, 0F,1F,ForgeDirection.NORTH);
+ Extruder.addTube("PipeN15", -5.5F, -0.5F, 0F, 5, 5, 7, 0.5F,1F,ForgeDirection.NORTH);
+ Extruder.addBox("Shape8", -5F, 4F, 6.9F, 4, 3, 1);
+ Extruder.addTube("PipeU17", -5.5F, -8F, -5F, 5, 8, 5, 0.8F,1F,ForgeDirection.UP);
+ Extruder.addTube("PipeUC18", -5.5F, 0F, -5F, 5, 2, 5, 0.8F,0.6F,ForgeDirection.UP);
+ Extruder.addBox("Shape14", -5F, 3F, -4.9F, 4, 4, 1);
+ Extruder.addTube("PipeN14", -5.5F, -0.5F, 7F, 5, 5, 1, 0.5F,1F,ForgeDirection.NORTH);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/ExtruderTileEntity.java b/src/main/java/ihl/processing/metallurgy/ExtruderTileEntity.java
new file mode 100644
index 0000000..a46ae62
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/ExtruderTileEntity.java
@@ -0,0 +1,155 @@
+package ihl.processing.metallurgy;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ic2.core.block.invslot.InvSlot.Access;
+import ihl.processing.chemistry.ApparatusProcessableInvSlot;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTank;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class ExtruderTileEntity extends BasicElectricMotorTileEntity{
+
+ public final ApparatusProcessableInvSlot input;
+ public final ApparatusProcessableInvSlot input2;
+ private int processTimer=0;
+ private FluidTank fluidTank = new FluidTank(1000);
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("extruder");
+
+ public ExtruderTileEntity()
+ {
+ super();
+ input = new ApparatusProcessableInvSlot(this, "input", 1, Access.IO, 1, 64);
+ input2 = new ApparatusProcessableInvSlot(this, "input2", 2, Access.IO, 1, 64);
+ }
+
+
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ return super.getNetworkedFields();
+ }
+
+
+ @Override
+ public String getInventoryName() {
+ return "Extruder";
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ ForgeDirection dir = ForgeDirection.getOrientation(getFacing());
+ TileEntity te = worldObj.getTileEntity(xCoord+dir.offsetX,yCoord+dir.offsetY,zCoord+dir.offsetZ);
+ if(checkCorrectAccembly() && this.fluidTank.getFluidAmount()>0 && this.processTimer++>20)
+ {
+ this.processTimer=0;
+ ((IFluidHandler)te).fill(ForgeDirection.getOrientation(getFacing()), this.fluidTank.drain(this.fluidTank.getCapacity(), true), true);
+ }
+
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer player)
+ {
+ return IHLUtils.getThisModItemStack("extruder");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new ExtruderGui(new ExtruderContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new ExtruderContainer(player, this);
+ }
+
+ @Override
+ public void operate()
+ {
+ UniversalRecipeInput ri = ExtruderTileEntity.recipeManager.getRecipeInput(getInput());
+ this.fluidTank.fill(getOutput().getFluidOutputs().get(0), true);
+ this.input.consume(ri.getItemInputs().get(0));
+ this.input2.consume(ri.getItemInputs().get(1));
+ }
+
+ public UniversalRecipeOutput getOutput()
+ {
+ return ExtruderTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public List[] getInput()
+ {
+ return new List[]{null,Arrays.asList(new ItemStack[] {input.get(),input2.get()})};
+ }
+
+ @Override
+ public boolean canOperate()
+ {
+ return this.fluidTank.getFluidAmount()<this.fluidTank.getCapacity() && this.getOutput()!=null && checkCorrectAccembly();
+ }
+
+ private boolean checkCorrectAccembly()
+ {
+ TileEntity te = worldObj.getTileEntity(xCoord+ForgeDirection.getOrientation(getFacing()).offsetX,yCoord+ForgeDirection.getOrientation(getFacing()).offsetY,zCoord+ForgeDirection.getOrientation(getFacing()).offsetZ);
+ return te instanceof IFluidHandler && ((IFluidHandler)te).canFill(ForgeDirection.getOrientation(getFacing()), FluidRegistry.getFluid("molten.rubberwithsulfur"));
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer arg0) {}
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+ }
+
+ public static void addRecipe(ItemStack input, ItemStack input2, FluidStack output)
+ {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, new ItemStack[] {input,input2}), new UniversalRecipeOutput(new FluidStack [] {output},null,20));
+ }
+
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/GasWeldingStationContainer.java b/src/main/java/ihl/processing/metallurgy/GasWeldingStationContainer.java
new file mode 100644
index 0000000..e960edb
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/GasWeldingStationContainer.java
@@ -0,0 +1,99 @@
+package ihl.processing.metallurgy;
+
+import java.util.List;
+
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GasWeldingStationContainer extends ContainerBase<GasWeldingStationTileEntity> {
+
+ protected GasWeldingStationTileEntity tileEntity;
+ public short lastProgress2 = -1;
+ private final static int height=166;
+ public int lastFluidAmount = -1;
+ public int lastNumberOfFluids = -1;
+ public int lastFluidAmount2 = -1;
+ public int lastNumberOfFluids2 = -1;
+ public List<FluidStack> fluidTankFluidList;
+ public List<FluidStack> fluidTankFluidList2;
+
+ public GasWeldingStationContainer(EntityPlayer entityPlayer, GasWeldingStationTileEntity weldingStation){
+ super(weldingStation);
+ this.tileEntity = weldingStation;
+ fluidTankFluidList = this.tileEntity.flammableGasTank.getFluidList();
+ fluidTankFluidList2 = this.tileEntity.oxygenTank.getFluidList();
+ int col;
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.drainInputSlotOxygen, 0, 8, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.drainInputSlotFlammableGas, 0, 44, 15));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.fillInputSlotOxygen, 0, 8, 51));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.fillInputSlotFlammableGas, 0, 44, 51));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.emptyFluidItemsSlot, 0, 8, 33));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.emptyFluidItemsSlot, 1, 44, 33));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.input, 0, 62, 51));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ if (this.tileEntity.progress2 != this.lastProgress2)
+ {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.progress2);
+ }
+ if (this.tileEntity.flammableGasTank.getFluidAmount() != this.lastFluidAmount || this.tileEntity.flammableGasTank.getNumberOfFluids() != this.lastNumberOfFluids)
+ {
+
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
+
+ if (this.tileEntity.oxygenTank.getFluidAmount() != this.lastFluidAmount2 || this.tileEntity.oxygenTank.getNumberOfFluids() != this.lastNumberOfFluids2)
+ {
+
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList2");
+ }
+ }
+
+
+ this.lastProgress2 = this.tileEntity.progress2;
+ this.lastNumberOfFluids = this.tileEntity.flammableGasTank.getNumberOfFluids();
+ this.lastFluidAmount = this.tileEntity.flammableGasTank.getFluidAmount();
+ this.lastNumberOfFluids2 = this.tileEntity.oxygenTank.getNumberOfFluids();
+ this.lastFluidAmount2 = this.tileEntity.oxygenTank.getFluidAmount();
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+ switch (index)
+ {
+ case 1:
+ this.tileEntity.progress2=(short) value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/GasWeldingStationGui.java b/src/main/java/ihl/processing/metallurgy/GasWeldingStationGui.java
new file mode 100644
index 0000000..79becd5
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/GasWeldingStationGui.java
@@ -0,0 +1,78 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.IC2;
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.inventory.Slot;
+import net.minecraft.util.ResourceLocation;
+
+@SideOnly(Side.CLIENT)
+public class GasWeldingStationGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIGasWeldingStation.png");
+ private GasWeldingStationContainer container;
+ private int outputslotoffset=45;
+
+ public GasWeldingStationGui (GasWeldingStationContainer detonationSprayingMachineContainer) {
+ //the container is instanciated and passed to the superclass for handling
+ super(detonationSprayingMachineContainer);
+ this.container=detonationSprayingMachineContainer;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.progress2 > 0)
+ {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27),27);
+ this.drawTexturedModalRect(90, 30, getFrameX(i1), getFrameY(i1),24,24);
+ }
+ if (this.container.tileEntity.flammableGasTank.getFluid()!=null && this.container.tileEntity.flammableGasTank.getFluidAmount() > 0)
+ {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.flammableGasTank, 64, 28, 76, 67, zLevel, par1, par2, xOffset, yOffset);
+ }
+ if (this.container.tileEntity.oxygenTank.getFluid()!=null && this.container.tileEntity.oxygenTank.getFluidAmount() > 0)
+ {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.oxygenTank, 28, 28, 40, 67, zLevel, par1, par2, xOffset, yOffset);
+ }
+
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ @Override
+ public void handleMouseClick(Slot slot,int arg1,int arg2,int arg3)
+ {
+ if(slot!=null && slot.slotNumber>=outputslotoffset && slot.slotNumber<outputslotoffset+8)
+ {
+ IC2.network.get().initiateClientTileEntityEvent(this.container.tileEntity, slot.slotNumber-outputslotoffset+1);
+ }
+ super.handleMouseClick(slot, arg1, arg2, arg3);
+ }
+
+ private int getFrameY(int number)
+ {
+ return (number % 10) * 24 + 14;
+ }
+
+ private int getFrameX(int number)
+ {
+ return (number / 10) * 24 + 176;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/GasWeldingStationModel.java b/src/main/java/ihl/processing/metallurgy/GasWeldingStationModel.java
new file mode 100644
index 0000000..d8675a6
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/GasWeldingStationModel.java
@@ -0,0 +1,108 @@
+package ihl.processing.metallurgy;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+// Date: 23.02.2015 12:31:33
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+
+public class GasWeldingStationModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+
+ public GasWeldingStationModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 13);
+ setTextureOffset("Base.Shape3", 0, 13);
+ setTextureOffset("Base.Shape16", 0, 13);
+ setTextureOffset("Base.Shape161", 0, 13);
+ setTextureOffset("Base.Shape162", 0, 13);
+ setTextureOffset("Base.Shape163", 0, 22);
+ setTextureOffset("Base.Shape164", 0, 13);
+ setTextureOffset("Base.Shape14", 0, 13);
+ setTextureOffset("Base.Shape165", 0, 13);
+ setTextureOffset("Base.Shape2", 0, 13);
+ setTextureOffset("Base.Shape4", 15, 17);
+ setTextureOffset("Base.Shape5", 12, 17);
+ setTextureOffset("Base.Cone176DOWN", 0, 0);
+ setTextureOffset("Base.Shape7", 0, 0);
+ setTextureOffset("Base.Cone173DOWN", 24, 0);
+ setTextureOffset("Base.Shape9", 24, 0);
+ setTextureOffset("Base.Cone172UP", 24, 0);
+ setTextureOffset("Base.Tube166UP", 48, 0);
+ setTextureOffset("Base.Tube168Up", 48, 0);
+ setTextureOffset("Base.Cone175UP", 0, 0);
+ setTextureOffset("Base.Tube169UP", 48, 4);
+ setTextureOffset("Base.Tube167UP", 50, 5);
+ setTextureOffset("Base.Tube170UP", 57, 2);
+ setTextureOffset("Base.Tube165UP", 48, 0);
+ setTextureOffset("Base.Shape20", 48, 0);
+ setTextureOffset("Base.Shape21", 48, 0);
+ setTextureOffset("Base.Shape22", 28, 0);
+ setTextureOffset("Base.Shape23", 28, 0);
+ setTextureOffset("Base.Shape24", 26, 0);
+ setTextureOffset("Base.Shape25", 26, 0);
+ setTextureOffset("Base.Shape26", 26, 0);
+ setTextureOffset("Base.Shape27", 0, 0);
+ setTextureOffset("Base.Shape28", 0, 0);
+ setTextureOffset("Base.Shape29", 0, 0);
+ setTextureOffset("Base.Shape30", 0, 0);
+ setTextureOffset("Base.Cone171WEST", 48, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, 0F, 1, 1, 8);
+ Base.addBox("Shape3", -7F, 7F, 0F, 14, 1, 1);
+ Base.addBox("Shape16", 7F, 7F, 0F, 1, 1, 8);
+ Base.addBox("Shape161", -8F, -1F, 0F, 1, 8, 1);
+ Base.addBox("Shape162", -8F, -2F, 1F, 1, 1, 6);
+ Base.addBox("Shape163", -8F, -2F, -0F, 16, 1, 1);
+ Base.addBox("Shape164", 7F, -1F, 0F, 1, 8, 1);
+ Base.addBox("Shape14", 7F, -2F, 1F, 1, 1, 6);
+ Base.addBox("Shape165", -8F, -2F, 7F, 16, 1, 1);
+ Base.addBox("Shape2", -7F, 7F, 7F, 14, 1, 1);
+ Base.addBox("Shape4", -8F, -1F, 7F, 1, 8, 1);
+ Base.addBox("Shape5", 7F, -1F, 7F, 1, 8, 1);
+ Base.addTube("Cone176DOWN", -7F, 5F, 1F, 6, 3, 6, 0.5F, 0.5F, ForgeDirection.UP);
+ Base.addTube("Shape7", -7F, -2F, 1F, 6, 7, 6, 0F, 1F, ForgeDirection.UP);
+ Base.addTube("Cone173DOWN", 1F, 5F, 1F, 6, 3, 6, 0.5F, 0.5F, ForgeDirection.UP);
+ Base.addTube("Shape9", 1F, -2F, 1F, 6, 7, 6, 0F, 1F, ForgeDirection.UP);
+ Base.addTube("Cone172UP", 1F, -5F, 1F, 6, 3, 6, 0.5F, 0.5F, ForgeDirection.DOWN);
+ Base.addTube("Tube166UP", 2.5F, -8F, 2.5F, 3, 1, 3, 0F, 1F, ForgeDirection.UP);
+ Base.addTube("Tube168Up", 2.5F, -6F, 2.5F, 3, 1, 3, 0F, 1F, ForgeDirection.UP);
+ Base.addTube("Cone175UP", -7F, -5F, 1F, 6, 3, 6, 0.5F, 0.5F, ForgeDirection.DOWN);
+ Base.addTube("Tube169UP", 3.5F, -7F, 3.5F, 1, 1, 1, 0F, 1F, ForgeDirection.UP);
+ Base.addTube("Tube167UP", -5.5F, -6F, 2.5F, 3, 1, 3, 0F, 1F, ForgeDirection.UP);
+ Base.addTube("Tube170UP", -4.5F, -7F, 3.5F, 1, 1, 1, 0F, 1F, ForgeDirection.UP);
+ Base.addTube("Tube165UP", -5.5F, -8F, 2.5F, 3, 1, 3, 0F, 1F, ForgeDirection.UP);
+ Base.addBox("Shape20", 1F, 7F, -7F, 7, 1, 1);
+ Base.addBox("Shape21", 0F, 7F, -7.5F, 1, 1, 2);
+ Base.addBox("Shape22", 3.5F, -6F, -1.5F, 1, 1, 4);
+ Base.addBox("Shape23", -3F, 7F, -6.5F, 3, 1, 1);
+ Base.addBox("Shape25",-2.8F, 7F, -1.5F, 7, 1, 1);
+ Base.addBox("Shape26",-3F, 6.9F, -6F, 1, 1, 5);
+ Base.addBox("Shape29",-4.7F, -5F, -1.5F, 1, 12, 1);
+ Base.addBox("Shape24", 3.4F, -5F, -1.5F, 1, 12, 1);
+ Base.addBox("Shape27", -5F, 7F, -8F, 5, 1, 1);
+ Base.addBox("Shape28", -4.5F, -6F, -1.5F, 1, 1, 4);
+ Base.addBox("Shape30", -4.9F, 6.9F, -7.5F, 1, 1, 7);
+ Base.addTube("Cone171WEST", 7F, 7F, -6F, 1, 1, 2, 0.5F, 0.5F, ForgeDirection.NORTH);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/GasWeldingStationTileEntity.java b/src/main/java/ihl/processing/metallurgy/GasWeldingStationTileEntity.java
new file mode 100644
index 0000000..b7172c2
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/GasWeldingStationTileEntity.java
@@ -0,0 +1,286 @@
+package ihl.processing.metallurgy;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.network.INetworkClientTileEntityEventListener;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlot.Access;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.interfaces.IWorkspaceElement;
+import ihl.processing.chemistry.ApparatusProcessableInvSlot;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class GasWeldingStationTileEntity extends TileEntityInventory implements IHasGui, INetworkClientTileEntityEventListener, IFluidHandler, IWorkspaceElement
+{
+ protected static final UniversalRecipeManager acetyleneRecipeManager = new UniversalRecipeManager("gasweldingstation");
+ public final ApparatusProcessableInvSlot input;
+ public final InvSlotConsumableLiquidIHL fillInputSlotFlammableGas;
+ public final InvSlotConsumableLiquidIHL fillInputSlotOxygen;
+ public final InvSlotConsumableLiquidIHL drainInputSlotFlammableGas;
+ public final InvSlotConsumableLiquidIHL drainInputSlotOxygen;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ public final IHLFluidTank flammableGasTank = new IHLFluidTank(8000);
+ public final IHLFluidTank oxygenTank = new IHLFluidTank(8000);
+ public short progress2;
+ protected short operationLength=200;
+
+ public GasWeldingStationTileEntity() {
+ super();
+ this.input = new ApparatusProcessableInvSlot(this, "input", 0, Access.IO, 1, 16);
+ this.fillInputSlotFlammableGas = new InvSlotConsumableLiquidIHL(this, "fillInputFlammableGas", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.fillInputSlotOxygen = new InvSlotConsumableLiquidIHL(this, "fillInputOxygen", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.drainInputSlotFlammableGas = new InvSlotConsumableLiquidIHL(this, "drainInputFlammableGas", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Drain);
+ this.drainInputSlotOxygen = new InvSlotConsumableLiquidIHL(this, "drainInputOxygen", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Drain);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 2);
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = super.getNetworkedFields();
+ return fields;
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ if (this.canProduceGas())
+ {
+ ++this.progress2;
+ if (this.progress2 >= this.operationLength)
+ {
+ this.produceGas();
+ this.progress2 = 0;
+ }
+ }
+ else
+ {
+ if (!this.canProduceGas())
+ {
+ this.progress2 = 0;
+ }
+ }
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlotFlammableGas, drainInputSlotFlammableGas, emptyFluidItemsSlot, flammableGasTank);
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlotOxygen, drainInputSlotOxygen, emptyFluidItemsSlot, oxygenTank);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.flammableGasTank.readFromNBT(nbttagcompound.getCompoundTag("flammableGasTank"));
+ this.oxygenTank.readFromNBT(nbttagcompound.getCompoundTag("oxygenTank"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound flammableGasTankNBT = new NBTTagCompound();
+ this.flammableGasTank.writeToNBT(flammableGasTankNBT);
+ nbttagcompound.setTag("flammableGasTank", flammableGasTankNBT);
+ NBTTagCompound oxygenTankNBT = new NBTTagCompound();
+ this.oxygenTank.writeToNBT(oxygenTankNBT);
+ nbttagcompound.setTag("oxygenTank", oxygenTankNBT);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return false;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("gasWeldingStation");
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "detonationSprayingMachine";
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new GasWeldingStationGui(new GasWeldingStationContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new GasWeldingStationContainer(player, this);
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer player) {}
+
+ @Override
+ public void onNetworkEvent(EntityPlayer player, int event)
+ {
+ }
+
+ public boolean canProduceGas()
+ {
+ UniversalRecipeOutput rOutput = GasWeldingStationTileEntity.acetyleneRecipeManager.getOutputFor(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}));
+ return rOutput!=null;
+ }
+
+ public void produceGas()
+ {
+ if(canProduceGas())
+ {
+ UniversalRecipeInput rInput = GasWeldingStationTileEntity.acetyleneRecipeManager.getRecipeInput(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}));
+ UniversalRecipeOutput rOutput = GasWeldingStationTileEntity.acetyleneRecipeManager.getOutputFor(Arrays.asList(new FluidStack[]{this.flammableGasTank.getFluid()}), Arrays.asList(new ItemStack[]{this.input.get()}));
+ FluidStack output1 = rOutput.getFluidOutputs().get(0).copy();
+ FluidStack output2 = rOutput.getFluidOutputs().get(1).copy();
+ this.flammableGasTank.drain(rInput.getFluidInputs().get(0), true);
+ this.input.get().stackSize-=rInput.getItemInputs().get(0).getAmount();
+ if(this.input.get().stackSize<=0)
+ {
+ this.input.clear();
+ }
+ this.flammableGasTank.fill(output1, true);
+ this.flammableGasTank.fill(output2, true);
+ }
+ }
+
+
+ public UniversalRecipeInput getInput()
+ {
+ return new UniversalRecipeInput(new FluidStack[] {this.flammableGasTank.getLigthestFluid(), this.oxygenTank.getFluid()}, new ItemStack[]{this.input.get(0),this.input.get(1),this.input.get(2)});
+ }
+
+ public static void addGasRecipe(ItemStack input, FluidStack inputFluid, FluidStack output, FluidStack output2)
+ {
+ acetyleneRecipeManager.addRecipe(new UniversalRecipeInput(new FluidStack[] {inputFluid},new ItemStack[] {input}), new UniversalRecipeOutput(new FluidStack [] {output, output2},new ItemStack [] {}, 20));
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getGasRecipes() {
+ return acetyleneRecipeManager.getRecipes();
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, int amount, boolean doDrain)
+ {
+ FluidStack fstack = this.flammableGasTank.drain(amount, doDrain);
+ return fstack;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) {
+ if(this.flammableGasTank.getFluid().containsFluid(fluidStack))
+ {
+ return this.flammableGasTank.drain(fluidStack.amount, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.oxygenTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[] {this.flammableGasTank.getInfo(),this.oxygenTank.getInfo()};
+ }
+
+
+ //1.7.10 API
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return true;
+ }
+
+ public int gaugeProgressScaled(int i)
+ {
+ return this.progress2 * i / this.operationLength;
+ }
+
+ public int gaugeFlammableGasScaled(int i)
+ {
+ if(this.flammableGasTank.getFluid()!=null)
+ {
+ return this.flammableGasTank.getFluidAmount() * i /this.flammableGasTank.getCapacity();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public int gaugeOxygenScaled(int i)
+ {
+ if(this.oxygenTank.getFluid()!=null)
+ {
+ return this.oxygenTank.getFluidAmount() * i /this.oxygenTank.getCapacity();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ @Override
+ public boolean canBeUsed()
+ {
+ return
+ this.flammableGasTank.getFluid()!=null &&
+ this.flammableGasTank.getLigthestFluid().getFluid().getName().equals("acetylene") &&
+ this.flammableGasTank.getLigthestFluid().amount>=20 &&
+ this.oxygenTank.getFluid()!=null &&
+ this.oxygenTank.getLigthestFluid().getFluid().getName().equals("oxygen") &&
+ this.oxygenTank.getLigthestFluid().amount>=20;
+ }
+
+ @Override
+ public void use()
+ {
+ this.flammableGasTank.drain(IHLUtils.getFluidStackWithSize("acetylene", 20), true);
+ this.oxygenTank.drain(IHLUtils.getFluidStackWithSize("oxygen", 20), true);
+ }
+
+ @Override
+ public boolean getIsInvalid()
+ {
+ return this.isInvalid();
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/IProductionLine.java b/src/main/java/ihl/processing/metallurgy/IProductionLine.java
new file mode 100644
index 0000000..5cf7605
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/IProductionLine.java
@@ -0,0 +1,12 @@
+package ihl.processing.metallurgy;
+
+import net.minecraft.item.ItemStack;
+
+public interface IProductionLine
+{
+
+ short getFacing();
+ boolean canProcess(ItemStack stack);
+ void process(ItemStack stack);
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineContainer.java b/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineContainer.java
new file mode 100644
index 0000000..d166889
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineContainer.java
@@ -0,0 +1,105 @@
+package ihl.processing.metallurgy;
+
+import java.util.List;
+
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraftforge.fluids.FluidStack;
+
+public class ImpregnatingMachineContainer extends ContainerBase<ImpregnatingMachineTileEntity> {
+
+ protected ImpregnatingMachineTileEntity tileEntity;
+ public int lastFluidAmount = -1;
+ public int lastNumberOfFluids = -1;
+ public int lastVisibleFluidID = -1;
+ public int lastVisibleFluidAmount = -1;
+ public short lastProgress = -1;
+ public short lastTemperature = -1;
+ private final static int height = 166;
+ public List<FluidStack> fluidTankFluidList;
+ public int fluidListHash = -1;
+
+ public ImpregnatingMachineContainer(EntityPlayer entityPlayer, ImpregnatingMachineTileEntity tileEntity1) {
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ fluidTankFluidList = this.tileEntity.getFluidTank().getFluidList();
+ int col;
+ for (col = 0; col < 3; ++col) {
+ for (int col1 = 0; col1 < 9; ++col1) {
+ this.addSlotToContainer(
+ new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+ for (col = 0; col < 9; ++col) {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.drainInputSlot, 0, 24, 16));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.emptyFluidItemsSlot, 0, 24, 34));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.fillInputSlot, 0, 24, 52));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 116, 16));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 116, 41));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 1, 116, 59));
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.crafters.get(i);
+
+ if (this.fluidListHash != fluidTankFluidList.hashCode()) {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ this.fluidListHash = fluidTankFluidList.hashCode();
+ }
+
+ if (this.tileEntity.progress != this.lastProgress) {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+
+ if (this.tileEntity.temperature != this.lastTemperature) {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.temperature);
+ }
+ if (this.tileEntity.visibleFluidId != this.lastVisibleFluidID) {
+ icrafting.sendProgressBarUpdate(this, 2, this.tileEntity.visibleFluidId);
+ }
+ if (this.tileEntity.visibleFluidAmount != this.lastVisibleFluidAmount) {
+ icrafting.sendProgressBarUpdate(this, 3, this.tileEntity.visibleFluidAmount);
+ }
+ }
+
+ this.lastNumberOfFluids = this.tileEntity.getNumberOfFluidsInTank();
+ this.lastFluidAmount = this.tileEntity.getTankAmount();
+ this.lastProgress = this.tileEntity.progress;
+ this.lastTemperature = this.tileEntity.temperature;
+ this.lastVisibleFluidID = this.tileEntity.visibleFluidId;
+ this.lastVisibleFluidAmount = this.tileEntity.visibleFluidAmount;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value) {
+ super.updateProgressBar(index, value);
+ switch (index) {
+ case 0:
+ this.tileEntity.progress = (short) value;
+ break;
+ case 1:
+ this.tileEntity.temperature = (short) value;
+ break;
+ case 2:
+ this.tileEntity.visibleFluidId = value;
+ break;
+ case 3:
+ this.tileEntity.visibleFluidAmount = value;
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineGui.java b/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineGui.java
new file mode 100644
index 0000000..29ba298
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineGui.java
@@ -0,0 +1,63 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+@SideOnly(Side.CLIENT)
+public class ImpregnatingMachineGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUITubBronze.png");
+ private ImpregnatingMachineContainer container;
+
+
+ public ImpregnatingMachineGui (ImpregnatingMachineContainer container1) {
+ //the container is instanciated and passed to the superclass for handling
+ super(container1);
+ this.container=container1;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
+ this.mc.renderEngine.bindTexture(background);
+ int i1;
+ if (this.container.tileEntity.progress > 0)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27),27);
+ this.drawTexturedModalRect(138, 28, getFrameX(i1), getFrameY(i1),24,24);
+ }
+ if (this.container.tileEntity.getTankAmount() > 0)
+ {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.getFluidTank(), 50, 11, 107, 72, zLevel, par1, par2, xOffset, yOffset);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ private int getFrameY(int number)
+ {
+ return (number % 10) * 24 + 14;
+ }
+
+ private int getFrameX(int number)
+ {
+ return (number / 10) * 24 + 176;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineRender.java b/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineRender.java
new file mode 100644
index 0000000..9529186
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineRender.java
@@ -0,0 +1,55 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import ihl.interfaces.IFluidTankVisual;
+import ihl.model.FluidRenderer;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class ImpregnatingMachineRender extends TileEntitySpecialRenderer {
+
+ private float cap;
+
+ public ImpregnatingMachineRender(float capIn) {
+ cap = capIn;
+ }
+
+ public void renderAModelAt(IFluidTankVisual tile, double x, double y, double z, float f) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
+ float rotation = 0F;
+ GL11.glRotatef(-rotation, 0F, 1F, 0F);
+ GL11.glScalef(1F, -1F, -1F);
+ GL11.glTranslatef(0F, -1.0F, 0F);
+ GL11.glPopMatrix();
+ if (tile.getVisibleFluidId() == -1 || tile.getVisibleFluidAmount() <= 0) {
+ return;
+ }
+ FluidStack fluidStack = new FluidStack(FluidRegistry.getFluid(tile.getVisibleFluidId()),
+ tile.getVisibleFluidAmount());
+ GL11.glPushMatrix();
+ GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glTranslatef((float) x, (float) y + 0.1F, (float) z);
+ GL11.glScalef(0.99F, 0.8F * tile.getRenderLiquidLevel(), 0.99F);
+ int[] displayLists = FluidRenderer.getLiquidDisplayLists(fluidStack);
+ if (displayLists != null) {
+ float level = Math.min(fluidStack.amount, cap) / cap;
+ bindTexture(FluidRenderer.getFluidSheet(fluidStack));
+ GL11.glCallList(displayLists[(int) (level * (FluidRenderer.DISPLAY_STAGES - 1))]);
+ }
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopAttrib();
+ GL11.glPopMatrix();
+
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity tile, double par2, double par4, double par6, float par8) {
+ this.renderAModelAt((IFluidTankVisual) tile, par2, par4, par6, par8);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java b/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java
new file mode 100644
index 0000000..4f7c529
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/ImpregnatingMachineTileEntity.java
@@ -0,0 +1,343 @@
+package ihl.processing.metallurgy;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.network.INetworkTileEntityEventListener;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlot.Access;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.interfaces.IFluidTankVisual;
+import ihl.processing.chemistry.ApparatusProcessableInvSlot;
+import ihl.processing.chemistry.ChemicalReactorTileEntity;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class ImpregnatingMachineTileEntity extends TileEntityInventory implements IHasGui,IFluidTankVisual,INetworkTileEntityEventListener, IFluidHandler
+{
+ private final static UniversalRecipeManager recipeManager = new UniversalRecipeManager("tub");
+ public final ApparatusProcessableInvSlot input;
+ public final IHLInvSlotOutput outputSlot;
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ public short progress;
+ protected short operationLength=Short.MAX_VALUE/2;
+ private final IHLFluidTank fluidTank = new IHLFluidTank(8000);
+ public short temperature=20;
+ public int visibleFluidId = -1;
+ public int visibleFluidAmount = 1;
+
+ public ImpregnatingMachineTileEntity() {
+ super();
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 2);
+ this.drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.TOP, InvSlotConsumableLiquid.OpType.Drain);
+ this.fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ this.emptyFluidItemsSlot = new InvSlotOutput(this, "fluidCellsOutput", 2, 1);
+ this.input = new ApparatusProcessableInvSlot(this, "input", 3, Access.IO, 1, 64);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return false;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("tubBronze");
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> ret = super.getNetworkedFields();
+ ret.add("visibleFluidId");
+ ret.add("visibleFluidAmount");
+ return ret;
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ if(this.fluidTank.getFluid()!=null)
+ {
+ if(this.fluidTank.getLigthestFluid().getFluid().isGaseous())
+ {
+ this.fluidTank.drainLightest(10, true);
+ }
+ }
+ if(this.fluidTank.getFluid()!=null && (visibleFluidId!=this.fluidTank.getFluid().getFluid().getID() || visibleFluidAmount!=this.fluidTank.getFluidAmount()))
+ {
+ visibleFluidId = this.fluidTank.getFluid().getFluid().getID();
+ visibleFluidAmount = this.fluidTank.getFluidAmount();
+ IC2.network.get().updateTileEntityField(this, "visibleFluidId");
+ IC2.network.get().updateTileEntityField(this, "visibleFluidAmount");
+ }
+ else if(this.fluidTank.getFluid()==null && visibleFluidId!=-1)
+ {
+ visibleFluidId=-1;
+ IC2.network.get().updateTileEntityField(this, "visibleFluidId");
+ }
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, fluidTank);
+ if (this.canOperate())
+ {
+ this.setActive(true);
+ if (this.progress == 0)
+ {
+ IC2.network.get().initiateTileEntityEvent(this, 0, true);
+ }
+
+ this.progress+=this.operationLength/this.getOutput().getTime();
+ if (this.progress >= this.operationLength)
+ {
+ this.operate();
+ this.progress = 0;
+ IC2.network.get().initiateTileEntityEvent(this, 2, true);
+ }
+ }
+ else
+ {
+ if (this.progress != 0 && this.getActive())
+ {
+ IC2.network.get().initiateTileEntityEvent(this, 1, true);
+ }
+ if (!this.canOperate())
+ {
+ this.progress = 0;
+ }
+ this.setActive(false);
+ }
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, int amount, boolean doDrain)
+ {
+ FluidStack fstack = this.fluidTank.drain(amount, doDrain);
+ return fstack;
+ }
+
+
+ //1.7.10 API
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid arg1) {
+ return true;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "impregnatingMachine";
+ }
+
+ public float getRenderLiquidLevel()
+ {
+ return (float)this.visibleFluidAmount/(float)this.fluidTank.getCapacity();
+ }
+
+ @Override
+ public void onNetworkEvent(int event)
+ {
+ }
+
+ public int gaugeProgressScaled(int i)
+ {
+ return this.progress * i / operationLength;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new ImpregnatingMachineGui(new ImpregnatingMachineContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player)
+ {
+ this.fluidTank.sortFluidsByDensity();
+ return new ImpregnatingMachineContainer(player, this);
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer player) {}
+
+ public boolean canOperate()
+ {
+ return getOutput()!=null && this.outputSlot.canAdd(getOutput().getItemOutputs());
+ }
+
+ public UniversalRecipeOutput getOutput()
+ {
+ return ImpregnatingMachineTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List[] getInput()
+ {
+ for(int i=0;i<fluidTank.getNumberOfFluids();i++)
+ {
+ for(int i1=0;i1<fluidTank.getNumberOfFluids();i1++)
+ {
+ if(i!=i1)
+ {
+ List[] rInput = new List[]{Arrays.asList(new FluidStack[]{fluidTank.getFluid(i),fluidTank.getFluid(i1)}), this.input.getItemStackList()};
+ if(ImpregnatingMachineTileEntity.recipeManager.getOutputFor(rInput)!=null)
+ {
+ return rInput;
+ }
+ }
+ }
+ }
+ return new List[] {Arrays.asList(new FluidStack[]{fluidTank.getFluid()}), this.input.getItemStackList()};
+ }
+
+ public void operate()
+ {
+ UniversalRecipeInput recipeInput = ImpregnatingMachineTileEntity.recipeManager.getRecipeInput(getInput());
+ UniversalRecipeOutput output1 = getOutput();
+ for(int i=0; i<recipeInput.getItemInputs().size();i++)
+ {
+ this.input.consume(recipeInput.getItemInputs().get(i));
+ }
+ this.fluidTank.drain(recipeInput.getFluidInputs(), true);
+ this.fluidTank.fill(output1.getFluidOutputs(), true);
+ if(!output1.getItemOutputs().isEmpty() && output1.getItemOutputs().get(0)!=null)this.outputSlot.add(output1.getItemOutputs());
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack fluidStack, boolean doDrain) {
+ if(fluidTank.getFluid()!=null && fluidTank.getFluid().containsFluid(fluidStack))
+ {
+ return this.fluidTank.drain(fluidStack, doDrain);
+ }
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.fluidTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[] {this.fluidTank.getInfo()};
+ }
+
+ @Override
+ public short getFacing()
+ {
+ return 3;
+ }
+
+ public boolean needsFluid()
+ {
+ return this.fluidTank.getFluidAmount() <= this.fluidTank.getCapacity();
+ }
+
+ public FluidStack getFluidStackfromTank()
+ {
+ return this.fluidTank.getFluid();
+ }
+
+ public int getTankAmount()
+ {
+ return this.fluidTank.getFluidAmount();
+ }
+
+ public int gaugeLiquidScaled(int i, int index)
+ {
+ return this.fluidTank.getFluidAmount() <= 0 ? 0 : this.fluidTank.getFluidAmount(index) * i / this.fluidTank.getCapacity();
+ }
+ public static void addRecipe(UniversalRecipeInput input, UniversalRecipeOutput output)
+ {
+ recipeManager.addRecipe(input, output);
+ }
+
+ public int getNumberOfFluidsInTank()
+ {
+ return this.fluidTank.getNumberOfFluids();
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ public static void addQuenchingRecipe(String nameHot, String nameQuenched)
+ {
+ addRecipe(new UniversalRecipeInput((new FluidStack[] {new FluidStack(FluidRegistry.WATER, 50)}), (new ItemStack[] {IHLUtils.getThisModItemStack(nameHot)})), new UniversalRecipeOutput(null, (new ItemStack[] {IHLUtils.getThisModItemStack(nameQuenched)}),2));
+ }
+
+ public IHLFluidTank getFluidTank()
+ {
+ return this.fluidTank;
+ }
+
+ public static void addChemicalRecipe(UniversalRecipeInput universalRecipeInput, UniversalRecipeOutput universalRecipeOutput)
+ {
+ addRecipe(universalRecipeInput,universalRecipeOutput);
+ ChemicalReactorTileEntity.addRecipe(universalRecipeInput,universalRecipeOutput);
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+
+ @Override
+ public int getVisibleFluidId() {
+ return this.visibleFluidId;
+ }
+
+ @Override
+ public int getVisibleFluidAmount() {
+ return this.visibleFluidAmount;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/InjectionMoldBlock.java b/src/main/java/ihl/processing/metallurgy/InjectionMoldBlock.java
new file mode 100644
index 0000000..bbea1cb
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/InjectionMoldBlock.java
@@ -0,0 +1,248 @@
+package ihl.processing.metallurgy;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ihl.IHLCreativeTab;
+import ihl.IHLModInfo;
+import ihl.items_blocks.IHLItemBlock;
+import ihl.metallurgy.constants.Details;
+import ihl.utils.IHLUtils;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.fluids.FluidStack;
+
+public class InjectionMoldBlock extends Block implements ITileEntityProvider{
+
+ IIcon textureSide;
+
+ public static InjectionMoldBlock instance;
+ public static String[] materials = new String[] {"Bronze","Steel","Gold","Magnesium", "Lithium", "TarPitch", "Potassium", "Sodium"};
+
+ public InjectionMoldBlock()
+ {
+ super(Material.rock);
+ this.setResistance(0.5F);
+ this.setHardness(0.5F);
+ this.setBlockName("injectionMold");
+ this.setCreativeTab(IHLCreativeTab.tab);
+ instance=this;
+ }
+
+ public static void init()
+ {
+ GameRegistry.registerBlock(new InjectionMoldBlock(),IHLItemBlock.class,"injectionMold");
+ GameRegistry.registerTileEntity(InjectionMoldTileEntity.class,"injectionMoldTileEntity");
+ }
+
+ @Override
+ public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int flag)
+ {
+ super.dropBlockAsItemWithChance(world, x, y, z, meta, chance, flag);
+ }
+
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList)
+ {
+ ItemStack result = new ItemStack(item);
+ result.stackTagCompound=new NBTTagCompound();
+ result.stackTagCompound.setString("resultSuffix", "ingot");
+ itemList.add(result);
+ }
+
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new InjectionMoldTileEntity();
+ }
+
+ @Override
+ public void onBlockPreDestroy(World world, int x, int y, int z, int meta)
+ {
+ if(!world.isRemote)
+ {
+ TileEntity te = world.getTileEntity(x, y, z);
+ if(te!=null && te instanceof InjectionMoldTileEntity)
+ {
+ InjectionMoldTileEntity gte = (InjectionMoldTileEntity) te;
+ gte.dropContents();
+ }
+ }
+ super.onBlockPreDestroy(world, x, y, z, meta);
+ }
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
+ TileEntity t = world.getTileEntity(x, y, z);
+ if(t!=null)
+ {
+ InjectionMoldTileEntity te = (InjectionMoldTileEntity)t;
+ if(te.result!=null)drops.add(te.result);
+ if(te.result2!=null)drops.add(te.result2);
+ }
+ return drops;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister par1IconRegister)
+ {
+ this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":injectionMoldTop");
+ this.textureSide = par1IconRegister.registerIcon(IHLModInfo.MODID + ":injectionMoldSide");
+ }
+
+ @Override
+ public boolean hasTileEntity(int metadata)
+ {
+ return true;
+ }
+
+ @Override
+ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack)
+ {
+ TileEntity t = world.getTileEntity(x, y, z);
+ if(t!=null && t instanceof InjectionMoldTileEntity)
+ {
+ InjectionMoldTileEntity te = (InjectionMoldTileEntity)t;
+ te.resultSuffix=itemStack.stackTagCompound.getString("resultSuffix");
+ if(itemStack.stackTagCompound.hasKey("isContainStearin"))
+ {
+ te.isContainStearin=itemStack.stackTagCompound.getBoolean("isContainStearin");
+ }
+ if(itemStack.stackTagCompound.hasKey("maxAmount"))
+ {
+ te.maxAmount=itemStack.stackTagCompound.getByte("maxAmount");
+ }
+
+ }
+ }
+ @Override
+ public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer player,int i,float pos_x,float pos_y,float pos_z)
+ {
+ if(player.getCurrentEquippedItem()!=null && player.getCurrentEquippedItem().getItem() instanceof Crucible)
+ {
+ if(!world.isRemote)
+ {
+ return ((Crucible)player.getCurrentEquippedItem().getItem()).onItemUse(player.getCurrentEquippedItem(), player, world, x, y, z, 0, pos_x, pos_y, pos_z);
+ }
+ return true;
+ }
+ return false;
+ }
+
+
+
+ /**
+ * Called when the block is placed in the world.
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
+ {
+ switch (side)
+ {
+ case 1:
+ return this.blockIcon;
+ case 0:
+ return this.textureSide;
+ case 2:
+ return this.textureSide;
+ case 3:
+ return this.textureSide;
+ case 4:
+ return this.textureSide;
+ case 5:
+ return this.textureSide;
+ default:
+ return this.textureSide;
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta)
+ {
+ switch (side)
+ {
+ case 1:
+ return this.blockIcon;
+ case 0:
+ return this.textureSide;
+ case 2:
+ return this.textureSide;
+ case 3:
+ return this.textureSide;
+ case 4:
+ return this.textureSide;
+ case 5:
+ return this.textureSide;
+ default:
+ return this.textureSide;
+ }
+ }
+
+ public ItemStack getSandInjectionMoldForResult(String result1)
+ {
+ ItemStack stack = new ItemStack(this);
+ stack.stackTagCompound=new NBTTagCompound();
+ stack.stackTagCompound.setString("resultSuffix", result1);
+ registerRecipes(result1, stack);
+ return stack;
+ }
+
+ public ItemStack getGypsumInjectionMoldForResult(String result1)
+ {
+ ItemStack stack = new ItemStack(this);
+ stack.stackTagCompound=new NBTTagCompound();
+ stack.stackTagCompound.setString("resultSuffix", result1);
+ stack.stackTagCompound.setByte("maxAmount", (byte)1);
+ stack.stackTagCompound.setBoolean("isContainStearin", true);
+ registerRecipes(result1, stack);
+ return stack;
+ }
+
+ public static void registerRecipes(String result1,ItemStack stack1)
+ {
+ for(int i=0;i<materials.length;i++)
+ {
+ String material = InjectionMoldBlock.materials[i];
+ ItemStack stack = IHLUtils.getItemStackIfExist(result1+material);
+ if(stack!=null)
+ {
+ material=material.toLowerCase(Locale.ROOT);
+ FluidStack fluidstack = IHLUtils.getFluidStackIfExist("molten."+material,Details.getMeltingFluidAmount(result1));
+ if(fluidstack!=null)
+ {
+ // Cap hash to positive integer range.
+ stack1.setItemDamage(result1.hashCode() & Integer.MAX_VALUE);
+/* IHLMod.log.info("Setting damage for injection mold to: "
+ +result1.toLowerCase(Locale.ROOT).hashCode()
+ +" using hash code of "+result1
+ +" Result of lower case: "+result1.toLowerCase(Locale.ROOT));*/
+ InjectionMoldTileEntity.addRecipe(fluidstack,stack1,stack);
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/InjectionMoldTileEntity.java b/src/main/java/ihl/processing/metallurgy/InjectionMoldTileEntity.java
new file mode 100644
index 0000000..e5fee82
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/InjectionMoldTileEntity.java
@@ -0,0 +1,201 @@
+package ihl.processing.metallurgy;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import ic2.core.IC2;
+import ihl.metallurgy.constants.Details;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLUtils;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTank;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+import net.minecraftforge.oredict.OreDictionary;
+
+
+public class InjectionMoldTileEntity extends TileEntity implements IFluidHandler
+{
+ public short timer = 100;
+ public String resultSuffix;
+ public boolean isContainStearin = false;
+ public short maxAmount=Short.MAX_VALUE;
+ public ItemStack result;
+ public ItemStack result2;
+ private final FluidTank fluidTank;
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("injectionmold");
+
+ public InjectionMoldTileEntity()
+ {
+ this.fluidTank = new FluidTank(864);//144 mB per ingot 1300 EU with 100% efficiency
+ }
+
+ public static void addRecipe(FluidStack input, ItemStack input1, ItemStack output)
+ {
+ recipeManager.addRecipe(new UniversalRecipeInput((new FluidStack[] {input}),(new ItemStack[] {input1})), new UniversalRecipeOutput(null,(new ItemStack[]{output}),20));
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ resultSuffix=nbttagcompound.getString("resultSuffix");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+ nbttagcompound.setString("resultSuffix",resultSuffix);
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void updateEntity()
+ {
+ if(this.getFluidStackfromTank()!=null && this.getFluidStackfromTank().amount>16)
+ {
+ if(this.timer--==0)
+ {
+ String formattedFluidName=this.getFormattedMaterialName(this.getFluidfromTank().getName());
+ if(formattedFluidName!="")
+ {
+ int fluidAmountPerItem = Details.getMeltingFluidAmount(this.resultSuffix);
+ ArrayList<ItemStack> resultList = OreDictionary.getOres(this.resultSuffix+formattedFluidName);
+ if(resultList.isEmpty() || fluidAmountPerItem<=0)
+ {
+ resultList=new ArrayList<ItemStack>();
+ List<FluidStack> fi = Arrays.asList(new FluidStack[] {this.fluidTank.getFluid()});
+ List<ItemStack> ii = Arrays.asList(new ItemStack[] {IHLUtils.getThisModItemStackWithDamage("injectionMold", this.resultSuffix.hashCode() & Integer.MAX_VALUE)});
+ UniversalRecipeOutput ro = recipeManager.getOutputFor(fi, ii);
+ if(ro!=null)
+ {
+ ItemStack stack = ro.getItemOutputs().get(0).itemStack.copy();
+ stack.stackSize=Math.round(ro.getItemOutputs().get(0).quantity);
+ resultList.add(stack);
+ UniversalRecipeInput ri = recipeManager.getRecipeInput(fi, ii);
+ fluidAmountPerItem = ri.getFluidInputs().get(0).getAmount();
+ }
+ }
+ int fluidAmountPerItem2 = Details.getMeltingFluidAmount("nugget");
+ ArrayList<ItemStack> resultList2 = OreDictionary.getOres("nugget"+formattedFluidName);
+ if(!resultList.isEmpty())
+ {
+ if(fluidAmountPerItem>0)
+ {
+ int stackSize1=Math.min(this.maxAmount,this.getFluidStackfromTank().amount/fluidAmountPerItem);
+ if(stackSize1>0)
+ {
+ result=resultList.get(0).copy();
+ result.stackSize=stackSize1;
+ }
+ }
+ }
+ if(!resultList2.isEmpty())
+ {
+ int stackSize1=this.getFluidStackfromTank().amount/fluidAmountPerItem2;
+ if(result!=null)
+ {
+ stackSize1=(this.getFluidStackfromTank().amount % fluidAmountPerItem)/fluidAmountPerItem2;
+ }
+ if(stackSize1>0)
+ {
+ result2=resultList2.get(0).copy();
+ result2.stackSize=stackSize1;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return false;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection direction, Fluid fluid1) {
+ return direction==ForgeDirection.UP && !isContainStearin;
+ }
+
+ public String getInventoryName() {
+ return "injectionMold";
+ }
+
+ private String getFormattedMaterialName(String input)
+ {
+ String input2 = input.replace("molten.", "").replace(".molten", "");
+ String firstletter = String.valueOf(input2.charAt(0)).toUpperCase();
+ input2 = input2.replaceFirst(".", firstletter);
+ return input2;
+ }
+
+ public FluidTank getFluidTank()
+ {
+ return this.fluidTank;
+ }
+
+ public FluidStack getFluidStackfromTank()
+ {
+ return this.getFluidTank().getFluid();
+ }
+
+ public Fluid getFluidfromTank()
+ {
+ return this.getFluidStackfromTank().getFluid();
+ }
+
+ @Override
+ public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
+ {
+ return this.canFill(from, resource.getFluid()) ? this.getFluidTank().fill(resource, doFill) : 0;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
+ {
+ return null;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
+ {
+ return this.getFluidTank().drain(maxDrain, doDrain);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection from)
+ {
+ return new FluidTankInfo[] {this.getFluidTank().getInfo()};
+ }
+
+ public void dropContents()
+ {
+ if(result!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, result));
+ if(result2!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, result2));
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes()
+ {
+ return recipeManager.getRecipes();
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/LatheContainer.java b/src/main/java/ihl/processing/metallurgy/LatheContainer.java
new file mode 100644
index 0000000..5e79a2a
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/LatheContainer.java
@@ -0,0 +1,72 @@
+package ihl.processing.metallurgy;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class LatheContainer extends ContainerBase<LathePart1TileEntity> {
+
+ public LathePart1TileEntity tileEntity;
+ public int lastProgress = -1;
+ private short lastEnergy = -1;
+ private final static int height=166;
+
+ public LatheContainer(EntityPlayer entityPlayer,
+ LathePart1TileEntity lathePart1TileEntity) {
+ super(lathePart1TileEntity);
+ tileEntity=lathePart1TileEntity;
+ int col;
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.dischargeSlot,0, 22, 55));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ if (this.tileEntity.progress != this.lastProgress)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+ if (this.tileEntity.getEnergy() != this.lastEnergy)
+ {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getEnergy());
+ }
+ }
+ this.lastProgress = this.tileEntity.progress;
+ this.lastEnergy = (short) this.tileEntity.getEnergy();
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+
+ switch (index)
+ {
+ case 0:
+ this.tileEntity.progress=(short) value;
+ break;
+ case 1:
+ this.tileEntity.setEnergy(value);
+ break;
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/LatheGui.java b/src/main/java/ihl/processing/metallurgy/LatheGui.java
new file mode 100644
index 0000000..16f64c5
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/LatheGui.java
@@ -0,0 +1,51 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+
+public class LatheGui extends GuiContainer {
+
+ private LatheContainer container;
+ protected static final ResourceLocation tex = new ResourceLocation("ihl", "textures/gui/GUILathe.png");
+
+ public LatheGui(LatheContainer latheContainer) {
+ super(latheContainer);
+ container = latheContainer;
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ fontRendererObj.drawString(StatCollector.translateToLocal("ihl.gui.lathe"), 50, 10, 14722081);
+ this.mc.renderEngine.bindTexture(tex);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(39, 55 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(50),50);
+ this.drawTexturedModalRect(64, 63, 197, 0, i1 + 1, 13);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/LathePart1Model.java b/src/main/java/ihl/processing/metallurgy/LathePart1Model.java
new file mode 100644
index 0000000..c08b3bf
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/LathePart1Model.java
@@ -0,0 +1,93 @@
+package ihl.processing.metallurgy;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class LathePart1Model extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+ IHLModelRenderer RotatingPart2;
+ IHLModelRenderer MotorPart1;
+ IHLModelRenderer MotorPart2;
+ IHLModelRenderer Belt;
+ IHLModelRenderer Belt2;
+
+ public LathePart1Model()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 0);
+ setTextureOffset("Base.Shape3", 0, 0);
+ setTextureOffset("Base.Shape2", 0, 0);
+ setTextureOffset("Base.NewShape4", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN1", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN7", 49, 23);
+ setTextureOffset("RotatingPart2.Shape1", 56, 19);
+ setTextureOffset("RotatingPart2.Shape5", 0, 8);
+ setTextureOffset("RotatingPart2.Shape8", 0, 11);
+ setTextureOffset("RotatingPart2.PipeN4", 0, 0);
+ setTextureOffset("RotatingPart2.Shape9", 0, 0);
+ setTextureOffset("MotorPart1.PipeN41", 0, 0);
+ setTextureOffset("MotorPart1.PipeN12", 0, 0);
+ setTextureOffset("MotorPart1.PipeN13", 0, 0);
+ setTextureOffset("MotorPart2.Shape4", 0, 24);
+ setTextureOffset("MotorPart2.Shape7", 0, 9);
+ setTextureOffset("MotorPart2.Shape10", 0, 9);
+ setTextureOffset("Belt.Shape12", 46, 0);
+ setTextureOffset("Belt2.Shape13", 46, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, -8F, 16, 1, 16);
+ Base.addBox("Shape3", -5.5F, -1.5F, -7F, 7, 9, 1);
+ Base.addBox("Shape2", -5.5F, -0.5F, -4F, 5, 8, 1);
+ Base.addBox("NewShape4", 3F, 3F, -6F, 3, 4, 1);
+ RotatingPart2 = new IHLModelRenderer(this, "RotatingPart2");
+ RotatingPart2.setRotationPoint(-3F, 18F, -7F);
+ setRotation(RotatingPart2, 0F, 0F, 0F);
+ RotatingPart2.mirror = true;
+ RotatingPart2.addTube("PipeN1", -1.5F, -1.5F, 0F, 3, 3, 5, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("PipeN7", -2.5F, -2.5F, -1F, 5, 5, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addBox("Shape1", 2F, -0.5F, 8.5F, 3, 1, 1);
+ RotatingPart2.addBox("Shape5", -0.5F, -5F, 8.5F, 1, 3, 1);
+ RotatingPart2.addBox("Shape8", -5F, -0.5F, 8.5F, 3, 1, 1);
+ RotatingPart2.addTube("PipeN4", -4F, -4F, 4F, 8, 8, 5, 0.3F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addBox("Shape9", -0.5F, 2F, 8.5F, 1, 3, 1);
+ MotorPart1 = new IHLModelRenderer(this, "MotorPart1");
+ MotorPart1.setRotationPoint(0F, 21F, 0F);
+ setRotation(MotorPart1, 0F, 0F, 0F);
+ MotorPart1.mirror = true;
+ MotorPart1.addTube("PipeN41", 3F, -2F, -8F, 3, 3, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN12", 4F, -1F, -7F, 1, 1, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN13", 3F, -2F, -5F, 3, 3, 5, 0F,1F,ForgeDirection.NORTH);
+ MotorPart2 = new IHLModelRenderer(this, "MotorPart2");
+ MotorPart2.setRotationPoint(0F, 16F, 0F);
+ setRotation(MotorPart2, 0F, 0F, 0F);
+ MotorPart2.mirror = true;
+ MotorPart2.addBox("Shape4", 3F, 3F, 0F, 3, 4, 4);
+ MotorPart2.addBox("Shape7", 6F, 3F, -5F, 2, 4, 5);
+ MotorPart2.addBox("Shape10", 1F, 3F, -5F, 2, 4, 5);
+ Belt = new IHLModelRenderer(this, "Belt");
+ Belt.setRotationPoint(-3F, 15.5F, -7.9F);
+ setRotation(Belt, 0F, 0F, 0.45F);
+ Belt.mirror = true;
+ Belt.addBox("Shape12", 0F, 0F, 0F, 8, 1, 1);
+ Belt2 = new IHLModelRenderer(this, "Belt2");
+ Belt2.setRotationPoint(-3F, 19.5F, -7.9F);
+ setRotation(Belt2, 0F, 0F, 0.19F);
+ Belt2.mirror = true;
+ Belt2.addBox("Shape13", 0F, 0F, 0F, 8, 1, 1);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/LathePart1TileEntity.java b/src/main/java/ihl/processing/metallurgy/LathePart1TileEntity.java
new file mode 100644
index 0000000..788bfd4
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/LathePart1TileEntity.java
@@ -0,0 +1,99 @@
+package ihl.processing.metallurgy;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.core.ContainerBase;
+import ihl.interfaces.IWorkspaceElement;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class LathePart1TileEntity extends BasicElectricMotorTileEntity implements IWorkspaceElement{
+
+ public boolean ready=false;
+
+ public LathePart1TileEntity()
+ {
+ super();
+ }
+
+
+ @Override
+ public String getInventoryName() {
+ return "Lathe";
+ }
+
+ @Override
+ public void operate()
+ {
+ ready=true;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer player)
+ {
+ return IHLUtils.getThisModItemStack("lathePart1");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new LatheGui(new LatheContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new LatheContainer(player, this);
+ }
+
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public List[] getInput()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean canOperate()
+ {
+ TileEntity te = worldObj.getTileEntity(xCoord+ForgeDirection.getOrientation(getFacing()).offsetX,yCoord,zCoord+ForgeDirection.getOrientation(getFacing()).offsetZ);
+ if(te!=null && te instanceof LathePart2TileEntity)
+ {
+ return !ready;
+ }
+ return false;
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer arg0) {}
+
+ @Override
+ public boolean canBeUsed()
+ {
+ return ready;
+ }
+
+ @Override
+ public void use()
+ {
+ ready=false;
+ }
+
+ @Override
+ public boolean getIsInvalid()
+ {
+ return this.isInvalid();
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/LathePart2Model.java b/src/main/java/ihl/processing/metallurgy/LathePart2Model.java
new file mode 100644
index 0000000..40b9b2a
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/LathePart2Model.java
@@ -0,0 +1,87 @@
+package ihl.processing.metallurgy;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class LathePart2Model extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+
+ public LathePart2Model()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 0);
+ setTextureOffset("Base.Shape1", 0, 0);
+ setTextureOffset("Base.Shape2", 38, 5);
+ setTextureOffset("Base.Shape3", 0, 0);
+ setTextureOffset("Base.Shape4", 0, 0);
+ setTextureOffset("Base.Shape5", 0, 0);
+ setTextureOffset("Base.PipeN7", 0, 0);
+ setTextureOffset("Base.Shape7", 0, 0);
+ setTextureOffset("Base.PipeW9", 0, 0);
+ setTextureOffset("Base.PipeW9", 0, 0);
+ setTextureOffset("Base.Shape9", 0, 0);
+ setTextureOffset("Base.Shape10", 0, 0);
+ setTextureOffset("Base.Shape11", 0, 0);
+ setTextureOffset("Base.Shape12", 0, 0);
+ setTextureOffset("Base.PipeW13", 0, 0);
+ setTextureOffset("Base.PipeN13", 0, 0);
+ setTextureOffset("Base.Shape13", 0, 0);
+ setTextureOffset("Base.Shape14", 0, 0);
+ setTextureOffset("Base.PipeU15", 0, 0);
+ setTextureOffset("Base.PipeU16", 0, 0);
+ setTextureOffset("Base.PipeU17", 0, 0);
+ setTextureOffset("Base.PipeU18", 0, 0);
+ setTextureOffset("Base.Shape15", 0, 0);
+ setTextureOffset("Base.Shape16", 0, 0);
+ setTextureOffset("Base.PipeW20", 0, 0);
+ setTextureOffset("Base.PipeW19", 0, 0);
+ setTextureOffset("Base.PipeN21", 0, 0);
+ setTextureOffset("Base.PipeN22", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, -8F, 14, 1, 16);
+ Base.addBox("Shape1", 0F, 1F, 0F, 4, 1, 4);
+ Base.addBox("Shape2", -2F, 2F, 1F, 5, 1, 1);
+ Base.addBox("Shape3", 0F, 3F, 0F, 4, 2, 4);
+ Base.addBox("Shape4", 2F, 6F, -8F, 1, 1, 16);
+ Base.addBox("Shape5", 5F, 6F, -8F, 1, 1, 13);
+ Base.addTube("PipeN7", 3.5F, 6F, -7F, 1, 1, 12, 0F,1F,ForgeDirection.NORTH);
+ Base.addBox("Shape7", 3F, 6F, -8F, 2, 1, 1);
+ Base.addTube("PipeW9", 6F, 5F, 5F, 1, 3, 3, 0F,1F,ForgeDirection.WEST);
+ Base.addTube("PipeW9", 7F, 6F, 5.2F, 1, 1, 1, 0F,1F,ForgeDirection.WEST);
+ Base.addBox("Shape9", 3F, 5F, 5F, 3, 2, 3);
+ Base.addBox("Shape10", -2F, 5F, 0F, 8, 1, 1);
+ Base.addBox("Shape11", -2F, 5F, 3F, 8, 1, 1);
+ Base.addBox("Shape12", 1F, 5F, 1F, 2, 1, 2);
+ Base.addTube("PipeW13", -1F, 5F, 1.5F, 6, 1, 1, 0F,1F,ForgeDirection.WEST);
+ Base.addTube("PipeN13", -4F, 1F, 3F, 2, 2, 3, 0F,1F,ForgeDirection.NORTH);
+ Base.addBox("Shape13", -3.5F, 2F, 3.8F, 1, 5, 2);
+ Base.addBox("Shape14", -4.5F, 6F, 2F, 3, 1, 4);
+ Base.addTube("PipeU15", 0F, 2F, 3F, 1, 1, 1, 0F,1F,ForgeDirection.UP);
+ Base.addTube("PipeU16", 3F, 2F, 3F, 1, 1, 1, 0F,1F,ForgeDirection.UP);
+ Base.addTube("PipeU17", 3F, 2F, 0F, 1, 1, 1, 0F,1F,ForgeDirection.UP);
+ Base.addTube("PipeU18", 0F, 2F, 0F, 1, 1, 1, 0F,1F,ForgeDirection.UP);
+ Base.addBox("Shape15", 5F, 5F, 1F, 1, 1, 2);
+ Base.addBox("Shape16", -2F, 5F, 1F, 1, 1, 2);
+ Base.addTube("PipeW20", 6F, 4F, 0.5F, 1, 3, 3, 0F,1F,ForgeDirection.WEST);
+ Base.addTube("PipeW19", 7F, 5F, 0.8F, 1, 1, 1, 0F,1F,ForgeDirection.WEST);
+ Base.addTube("PipeN21", -4.5F, 0.5F, 6F, 3, 3, 1, 0F,1F,ForgeDirection.NORTH);
+ Base.addTube("PipeN22", -3F, 1F, 7F, 1, 1, 1, 0F,1F,ForgeDirection.NORTH);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/LathePart2TileEntity.java b/src/main/java/ihl/processing/metallurgy/LathePart2TileEntity.java
new file mode 100644
index 0000000..7d4dac7
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/LathePart2TileEntity.java
@@ -0,0 +1,104 @@
+package ihl.processing.metallurgy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ic2.api.network.INetworkDataProvider;
+import ic2.api.tile.IWrenchable;
+import ic2.core.IC2;
+import ihl.utils.IHLUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+
+public class LathePart2TileEntity extends TileEntity implements IWrenchable, INetworkDataProvider{
+
+ private short facing=2;
+ private short lastFacing=2;
+
+ public LathePart2TileEntity()
+ {
+ super();
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = new ArrayList();
+ fields.add("facing");
+ return fields;
+ }
+
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+ if(lastFacing!=facing)
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ lastFacing=facing;
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=side;
+ }
+
+
+ @Override
+ public short getFacing() {
+ return this.facing;
+ }
+
+
+ @Override
+ public void setFacing(short facing1)
+ {
+ facing=(short) Math.max(2,facing1);
+ if(IC2.platform.isSimulating())
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ lastFacing=facing;
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
+ return true;
+ }
+
+
+ @Override
+ public float getWrenchDropRate() {
+ return 1F;
+ }
+
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("lathePart2");
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ facing=nbttagcompound.getShort("facing");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setShort("facing", facing);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/MachineBaseContainer.java b/src/main/java/ihl/processing/metallurgy/MachineBaseContainer.java
new file mode 100644
index 0000000..d7e3ac7
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/MachineBaseContainer.java
@@ -0,0 +1,74 @@
+package ihl.processing.metallurgy;
+
+import ic2.core.ContainerBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class MachineBaseContainer extends ContainerBase<MachineBaseTileEntity> {
+
+ protected MachineBaseTileEntity tileEntity;
+ public int lastProgress = -1;
+ private short lastEnergy;
+ private final static int height=166;
+
+ public MachineBaseContainer(EntityPlayer entityPlayer, MachineBaseTileEntity tileEntity1){
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ int col;
+
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ if (this.tileEntity.progress != this.lastProgress)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+ if (this.tileEntity.getEnergy() != this.lastEnergy)
+ {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getEnergy());
+ }
+ }
+ this.lastProgress = this.tileEntity.progress;
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+
+ switch (index)
+ {
+ case 0:
+ this.tileEntity.progress=(short) value;
+ break;
+ case 1:
+ this.tileEntity.setEnergy(value);
+ break;
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/MachineBaseTileEntity.java b/src/main/java/ihl/processing/metallurgy/MachineBaseTileEntity.java
new file mode 100644
index 0000000..79763b5
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/MachineBaseTileEntity.java
@@ -0,0 +1,279 @@
+package ihl.processing.metallurgy;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.energy.event.EnergyTileLoadEvent;
+import ic2.api.energy.event.EnergyTileUnloadEvent;
+import ic2.api.energy.tile.IEnergySink;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot.Access;
+import ihl.processing.chemistry.ApparatusProcessableInvSlot;
+import ihl.recipes.UniversalRecipeOutput;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public abstract class MachineBaseTileEntity extends TileEntityInventory implements IHasGui, IEnergySink
+{
+ public short progress;
+ protected short operationLength=200;
+ protected double energy;
+ public int maxStorage;
+ public int energyConsume;
+ public final ApparatusProcessableInvSlot input;
+ private boolean addedToEnergyNet=false;
+
+ public MachineBaseTileEntity(int inputCount)
+ {
+ input = new ApparatusProcessableInvSlot(this, "input", 0, Access.IO, inputCount, 64);
+ maxStorage=128;
+ energyConsume=5;
+ }
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = super.getNetworkedFields();
+ return fields;
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.progress = nbttagcompound.getShort("progress");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setShort("progress", this.progress);
+ }
+
+ @Override
+ public void onLoaded()
+ {
+ super.onLoaded();
+ if (IC2.platform.isSimulating()&&!this.addedToEnergyNet)
+ {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+ }
+
+ @Override
+ public void onUnloaded()
+ {
+ if (IC2.platform.isSimulating()&&this.addedToEnergyNet)
+ {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+
+ super.onUnloaded();
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=(short)side;
+ }
+
+ @Override
+ public void setFacing(short facing1)
+ {
+ if (IC2.platform.isSimulating()&&this.addedToEnergyNet)
+ {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+ super.setFacing(facing1);
+ if (IC2.platform.isSimulating()&&!this.addedToEnergyNet)
+ {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ public abstract String getStartSoundFile();
+
+ public abstract String getLoopSoundFile();
+
+ public abstract String getStopSoundFile();
+
+ @Override
+ public void updateEntityServer()
+ {
+ if(this.energy>this.maxStorage)
+ {
+ this.energy=this.maxStorage;
+ }
+
+ if (this.canOperate() && this.energy >= this.energyConsume)
+ {
+ this.setActive(true);
+
+ if (this.progress == 0)
+ {
+ IC2.network.get().initiateTileEntityEvent(this, 0, true);
+ }
+
+ ++this.progress;
+ this.energy -= this.energyConsume;
+
+ if (this.progress >= this.operationLength)
+ {
+ this.operate();
+ this.progress = 0;
+ IC2.network.get().initiateTileEntityEvent(this, 2, true);
+ }
+ }
+ else
+ {
+ if (this.progress != 0 && this.getActive())
+ {
+ IC2.network.get().initiateTileEntityEvent(this, 1, true);
+ }
+ if (!this.canOperate())
+ {
+ this.progress = 0;
+ }
+ this.setActive(false);
+ }
+ }
+
+ protected int mX()
+ {
+ switch(this.getFacing())
+ {
+ case 4:
+ return 1;
+ case 5:
+ return -1;
+ default:
+ return 0;
+ }
+ }
+
+ protected int mY()
+ {
+ switch(this.getFacing())
+ {
+ case 0:
+ return -1;
+ case 1:
+ return 1;
+ default:
+ return 0;
+ }
+ }
+
+ protected int mZ()
+ {
+ switch(this.getFacing())
+ {
+ case 2:
+ return 1;
+ case 3:
+ return -1;
+ default:
+ return 0;
+ }
+ }
+
+ @Override
+ public abstract String getInventoryName();
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public abstract GuiScreen getGui(EntityPlayer arg0, boolean arg1);
+
+ @Override
+ public abstract ContainerBase<?> getGuiContainer(EntityPlayer arg0);
+
+ @Override
+ public void onGuiClosed(EntityPlayer arg0) {}
+
+ public int gaugeProgressScaled(int i)
+ {
+ return this.progress * i / this.operationLength;
+ }
+
+ public boolean canOperate()
+ {
+ return getOutput()!=null;
+ }
+
+ public abstract UniversalRecipeOutput getOutput();
+
+ @SuppressWarnings("rawtypes")
+ public List[] getInput()
+ {
+ return new List[]{null, this.input.getItemStackList()};
+ }
+
+
+ @Override
+ public double getDemandedEnergy()
+ {
+ return this.maxStorage - this.energy;
+ }
+
+ @Override
+ public int getSinkTier()
+ {
+ return 4;
+ }
+
+ @Override
+ public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
+ {
+ if (this.energy >= this.maxStorage)
+ {
+ return amount;
+ }
+ else
+ {
+ this.energy += amount;
+ return 0.0D;
+ }
+ }
+
+ @Override
+ public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
+ {
+ return true;
+ }
+
+
+ public abstract void operate();
+ public short getEnergy() {
+ return (short)this.energy;
+ }
+ public void setEnergy(int value)
+ {
+ this.energy=value;
+ }
+ public int getGUIEnergy(int i) {
+ if(this.energy<Float.MAX_VALUE)
+ {
+ return Math.round((float)this.energy/this.maxStorage*i);
+ }
+ else
+ {
+ return Math.round((float)(this.energy/this.maxStorage)*i);
+ }
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/MuffleFurnaceGui.java b/src/main/java/ihl/processing/metallurgy/MuffleFurnaceGui.java
new file mode 100644
index 0000000..9c83401
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/MuffleFurnaceGui.java
@@ -0,0 +1,48 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+
+public class MuffleFurnaceGui extends GuiContainer {
+ protected static final ResourceLocation muffleFurnaceBackground = new ResourceLocation("ihl", "textures/gui/GUIAchesonFurnace.png");
+ private MachineBaseContainer container;
+
+ public MuffleFurnaceGui(MachineBaseContainer machineBaseContainer) {
+ //the container is instanciated and passed to the superclass for handling
+ super(machineBaseContainer);
+ this.container=machineBaseContainer;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(muffleFurnaceBackground);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(8, 6 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(17),17);
+ this.drawTexturedModalRect(70,34, 197, 0, i1 + 1, 13);
+ }
+ fontRendererObj.drawStringWithShadow(StatCollector.translateToLocal("ihl.gui.muffleFurnace"), 40, 12, 16768125);
+
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(muffleFurnaceBackground);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/MuffleFurnanceContainer.java b/src/main/java/ihl/processing/metallurgy/MuffleFurnanceContainer.java
new file mode 100644
index 0000000..1ae7203
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/MuffleFurnanceContainer.java
@@ -0,0 +1,16 @@
+package ihl.processing.metallurgy;
+
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class MuffleFurnanceContainer extends MachineBaseContainer {
+
+ public MuffleFurnanceContainer(EntityPlayer entityPlayer,
+ MuffleFurnanceTileEntity tileEntity1) {
+ super(entityPlayer, tileEntity1);
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 40, 22));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 1, 40, 40));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.outputSlot, 0, 98, 32));
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java b/src/main/java/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java
new file mode 100644
index 0000000..6f811cb
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java
@@ -0,0 +1,119 @@
+package ihl.processing.metallurgy;
+
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.recipe.IRecipeInput;
+import ic2.core.ContainerBase;
+import ihl.IHLMod;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.recipes.RecipeOutputItemStack;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+
+public class MuffleFurnanceTileEntity extends MachineBaseTileEntity {
+
+ protected static UniversalRecipeManager recipeManager = new UniversalRecipeManager("mufflefurnace");
+ public final IHLInvSlotOutput outputSlot;
+
+ public MuffleFurnanceTileEntity() {
+ super(2);
+ this.outputSlot = new IHLInvSlotOutput(this, "output", 0, 1);
+ }
+
+ @Override
+ public String getStartSoundFile() {
+ return null;
+ }
+
+ @Override
+ public String getLoopSoundFile() {
+ return null;
+ }
+
+ @Override
+ public String getStopSoundFile() {
+ return null;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "MuffleFurnance";
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new MuffleFurnaceGui(new MuffleFurnanceContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new MuffleFurnanceContainer(player, this);
+ }
+
+ @Override
+ public boolean canOperate() {
+ ItemStack crucible = input.getItemStack(IHLMod.crucible);
+ if (crucible != null) {
+ return true;
+ }
+ ItemStack mold = input.getItemStack(IHLUtils.getThisModItem("injectionMold"));
+ if (mold != null) {
+ return true;
+ }
+ return getOutput() != null;
+ }
+
+ @Override
+ public void operate() {
+ ItemStack crucible = input.getItemStack(IHLMod.crucible);
+ if (crucible != null) {
+ ((Crucible) crucible.getItem()).processContent(crucible, this);
+ return;
+ }
+ ItemStack mold = input.getItemStack(IHLUtils.getThisModItem("injectionMold"));
+ if (mold != null) {
+ mold.stackTagCompound.setBoolean("isContainStearin", false);
+ return;
+ }
+ List<RecipeOutputItemStack> output = recipeManager
+ .getOutputFor(getInput()).getItemOutputs();
+ List<IRecipeInput> rinput = recipeManager.getRecipeInput(getInput()).getItemInputs();
+ for (int i = 0; i < rinput.size(); i++) {
+ this.input.consume(rinput.get(i));
+ }
+ this.outputSlot.add(output);
+ }
+
+ public static void addRecipe(IRecipeInput recipeInputOreDict, ItemStack output) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { recipeInputOreDict })),
+ new UniversalRecipeOutput(null, (new ItemStack[] { output }), 20));
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ @Override
+ public UniversalRecipeOutput getOutput() {
+ return MuffleFurnanceTileEntity.recipeManager.getOutputFor(null, this.input.getItemStackList());
+ }
+
+ public static void addRecipe(UniversalRecipeInput universalRecipeInput,
+ UniversalRecipeOutput universalRecipeOutput) {
+ recipeManager.addRecipe(universalRecipeInput, universalRecipeOutput);
+ }
+
+ public static void addRecipe(IRecipeInput recipeInputOreDict, ItemStack output, float f) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] { recipeInputOreDict })), new UniversalRecipeOutput(
+ null, (new RecipeOutputItemStack[] { new RecipeOutputItemStack(output, f) }), 20));
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/RollingMachineContainer.java b/src/main/java/ihl/processing/metallurgy/RollingMachineContainer.java
new file mode 100644
index 0000000..7a83d9d
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/RollingMachineContainer.java
@@ -0,0 +1,75 @@
+package ihl.processing.metallurgy;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class RollingMachineContainer extends ContainerBase<RollingMachinePart1TileEntity> {
+
+ public RollingMachinePart1TileEntity tileEntity;
+ public int lastProgress = -1;
+ private short lastEnergy = -1;
+ private final static int height=166;
+
+ public RollingMachineContainer(EntityPlayer entityPlayer,
+ RollingMachinePart1TileEntity lathePart1TileEntity) {
+ super(lathePart1TileEntity);
+ tileEntity=lathePart1TileEntity;
+ int col;
+
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.input, 0, 54, 25));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.output, 0, 105, 25));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.dischargeSlot,0, 22, 55));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ if (this.tileEntity.progress != this.lastProgress)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+ if (this.tileEntity.getEnergy() != this.lastEnergy)
+ {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getEnergy());
+ }
+ }
+ this.lastProgress = this.tileEntity.progress;
+ this.lastEnergy = (short) this.tileEntity.getEnergy();
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+
+ switch (index)
+ {
+ case 0:
+ this.tileEntity.progress=(short) value;
+ break;
+ case 1:
+ this.tileEntity.setEnergy(value);
+ break;
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/RollingMachineGui.java b/src/main/java/ihl/processing/metallurgy/RollingMachineGui.java
new file mode 100644
index 0000000..a792bd3
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/RollingMachineGui.java
@@ -0,0 +1,50 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+public class RollingMachineGui extends GuiContainer {
+
+ private RollingMachineContainer container;
+ protected static final ResourceLocation tex = new ResourceLocation("ihl", "textures/gui/GUIRollingMachine.png");
+
+ public RollingMachineGui(RollingMachineContainer latheContainer) {
+ super(latheContainer);
+ container = latheContainer;
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(39, 55 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(50),50);
+ this.drawTexturedModalRect(64, 63, 197, 0, i1 + 1, 13);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/RollingMachinePart1Model.java b/src/main/java/ihl/processing/metallurgy/RollingMachinePart1Model.java
new file mode 100644
index 0000000..fe062f8
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/RollingMachinePart1Model.java
@@ -0,0 +1,97 @@
+package ihl.processing.metallurgy;
+
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+
+public class RollingMachinePart1Model extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+ IHLModelRenderer RotatingPart2;
+ IHLModelRenderer MotorPart1;
+ IHLModelRenderer MotorPart2;
+ IHLModelRenderer RotatingPart1;
+ IHLModelRenderer Plate;
+
+ public RollingMachinePart1Model()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 0);
+ setTextureOffset("Base.Shape16", 0, 0);
+ setTextureOffset("Base.Shape5", 0, 0);
+ setTextureOffset("Base.Shape8", 0, 0);
+ setTextureOffset("Base.Shape11", 0, 0);
+ setTextureOffset("Base.Shape9", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN7", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN17", 0, 0);
+ setTextureOffset("RotatingPart2.Shape3", 0, 0);
+ setTextureOffset("RotatingPart2.Shape12", 0, 0);
+ setTextureOffset("MotorPart1.PipeN41", 0, 0);
+ setTextureOffset("MotorPart1.PipeN12", 0, 0);
+ setTextureOffset("MotorPart1.PipeN13", 0, 0);
+ setTextureOffset("MotorPart2.Shape4", 0, 24);
+ setTextureOffset("MotorPart2.Shape7", 0, 9);
+ setTextureOffset("MotorPart2.Shape10", 0, 9);
+ setTextureOffset("RotatingPart1.Shape1", 0, 0);
+ setTextureOffset("RotatingPart1.Shape2", 0, 0);
+ setTextureOffset("RotatingPart1.Shape13", 0, 0);
+ setTextureOffset("Plate.Shape14", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, -8F, 16, 1, 16);
+ Base.addBox("Shape16", -3F, -7F, -6F, 9, 14, 1);
+ Base.addBox("Shape5", 2F, -1F, -5F, 6, 1, 13);
+ Base.addBox("Shape8", -8F, -1F, -5F, 6, 1, 13);
+ Base.addBox("Shape11", 3F, 0F, 7F, 4, 7, 1);
+ Base.addBox("Shape9", -7F, 0F, 7F, 4, 7, 1);
+ RotatingPart2 = new IHLModelRenderer(this, "RotatingPart2");
+ RotatingPart2.setRotationPoint(0F, 16F, -7F);
+ setRotation(RotatingPart2, 0F, 0F, 0F);
+ RotatingPart2.mirror = true;
+ RotatingPart2.addTube("PipeN7", -5.5F, -5.5F, -0.9F, 11, 11, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("PipeN17", -2F, -2F, 2F, 4, 4, 26, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("Shape3", -2.5F, -2.5F, 0F, 5, 5, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("Shape12", -1F, -1F, 28F, 2, 2, 3, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1 = new IHLModelRenderer(this, "MotorPart1");
+ MotorPart1.setRotationPoint(4.5F, 20.5F, 0F);
+ setRotation(MotorPart1, 0F, 0F, 0F);
+ MotorPart1.mirror = true;
+ MotorPart1.addTube("PipeN41", -1.5F, -1.5F, -8F, 3, 3, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN12", -0.5F, -0.5F, -7F, 1, 1, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN13", -1.5F, -1.5F, -5F, 3, 3, 5, 0F,1F,ForgeDirection.NORTH);
+ MotorPart2 = new IHLModelRenderer(this, "MotorPart2");
+ MotorPart2.setRotationPoint(0F, 16F, 0F);
+ setRotation(MotorPart2, 0F, 0F, 0F);
+ MotorPart2.mirror = true;
+ MotorPart2.addBox("Shape4", 3F, 3F, 0F, 3, 4, 4);
+ MotorPart2.addBox("Shape7", 6F, 3F, -5F, 2, 4, 5);
+ MotorPart2.addBox("Shape10", 1F, 3F, -5F, 2, 4, 5);
+ RotatingPart1 = new IHLModelRenderer(this, "RotatingPart1");
+ RotatingPart1.setRotationPoint(0F, 11.9F, -5F);
+ setRotation(RotatingPart1, 0F, 0F, 0F);
+ RotatingPart1.mirror = true;
+ RotatingPart1.addTube("Shape1", -2F, -2F, 0F, 4, 4, 26, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart1.addTube("Shape2", -2.5F, -2.5F, -1.9F, 5, 5, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart1.addTube("Shape13", -1F, -1F, 26F, 2, 2, 3, 0F,1F,ForgeDirection.NORTH);
+ Plate = new IHLModelRenderer(this, "Plate");
+ Plate.setRotationPoint(0F, 13.5F, 0F);
+ setRotation(Plate, 0F, 0F, 0F);
+ Plate.mirror = true;
+ Plate.addBox("Shape14", -18F, 0F, 0F, 16, 1, 16);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java b/src/main/java/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java
new file mode 100644
index 0000000..da60877
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/RollingMachinePart1TileEntity.java
@@ -0,0 +1,149 @@
+package ihl.processing.metallurgy;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.recipe.IRecipeInput;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.block.invslot.InvSlot.Access;
+import ihl.processing.chemistry.ApparatusProcessableInvSlot;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.recipes.RecipeOutputItemStack;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class RollingMachinePart1TileEntity extends BasicElectricMotorTileEntity{
+
+ public final ApparatusProcessableInvSlot input;
+ public final IHLInvSlotOutput output;
+ public boolean assembled;
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("rollingmachine");
+
+ public RollingMachinePart1TileEntity()
+ {
+ super();
+ input = new ApparatusProcessableInvSlot(this, "input", 1, Access.IO, 1, 64);
+ output = new IHLInvSlotOutput(this, "output", 2, 1);
+ }
+
+ public UniversalRecipeOutput getOutput()
+ {
+ return RollingMachinePart1TileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = super.getNetworkedFields();
+ fields.add("assembled");
+ return fields;
+ }
+
+
+ @Override
+ public String getInventoryName() {
+ return "RollingMachine";
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ if(assembled && !this.checkCorrectAccembly())
+ {
+ assembled=false;
+ IC2.network.get().updateTileEntityField(this, "assembled");
+ }
+ else if(!assembled && this.checkCorrectAccembly())
+ {
+ assembled=true;
+ IC2.network.get().updateTileEntityField(this, "assembled");
+ }
+ if (this.getActive() && this.progress == 0 && !this.canOperate())
+ {
+ this.setActive(false);
+ }
+
+ if (!this.getActive() && this.progress>0 && this.canOperate())
+ {
+ this.setActive(true);
+ }
+
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer player)
+ {
+ return IHLUtils.getThisModItemStack("rollingMachinePart1");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new RollingMachineGui(new RollingMachineContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new RollingMachineContainer(player, this);
+ }
+
+ @Override
+ public void operate()
+ {
+ List<IRecipeInput> rinput = recipeManager.getRecipeInput(getInput()).getItemInputs();
+ List<RecipeOutputItemStack> output = RollingMachinePart1TileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
+ this.output.add(output);
+ this.input.consume(rinput.get(0));
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public List[] getInput()
+ {
+ return new List[]{null, Arrays.asList(new ItemStack[] {input.get()})};
+ }
+
+ @Override
+ public boolean canOperate()
+ {
+ return this.getOutput()!=null && this.output.canAdd(this.getOutput().getItemOutputs()) && checkCorrectAccembly();
+ }
+
+ private boolean checkCorrectAccembly()
+ {
+ TileEntity te = worldObj.getTileEntity(xCoord+ForgeDirection.getOrientation(getFacing()).offsetX,yCoord+ForgeDirection.getOrientation(getFacing()).offsetY,zCoord+ForgeDirection.getOrientation(getFacing()).offsetZ);
+ return te!=null && te instanceof RollingMachinePart2TileEntity && ((RollingMachinePart2TileEntity)te).getFacing()==this.getFacing();
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer arg0) {}
+
+ public static void addRecipe(ItemStack input, ItemStack output)
+ {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack [] {input})), new UniversalRecipeOutput(null, (new ItemStack[] {output}), 20));
+ }
+
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/RollingMachinePart2Model.java b/src/main/java/ihl/processing/metallurgy/RollingMachinePart2Model.java
new file mode 100644
index 0000000..39fd1f5
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/RollingMachinePart2Model.java
@@ -0,0 +1,42 @@
+package ihl.processing.metallurgy;
+
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+
+public class RollingMachinePart2Model extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+
+ public RollingMachinePart2Model()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 0);
+ setTextureOffset("Base.Shape16", 0, 0);
+ setTextureOffset("Base.Shape5", 0, 0);
+ setTextureOffset("Base.Shape8", 0, 0);
+ setTextureOffset("Base.Shape11", 0, 0);
+ setTextureOffset("Base.Shape9", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, -8F, 16, 1, 16);
+ Base.addBox("Shape16", -3F, -7F, 5F, 6, 14, 1);
+ Base.addBox("Shape5", 2F, -1F, -8F, 6, 1, 13);
+ Base.addBox("Shape8", -8F, -1F, -8F, 6, 1, 13);
+ Base.addBox("Shape11", 3F, 0F, -8F, 4, 7, 1);
+ Base.addBox("Shape9", -7F, 0F, -8F, 4, 7, 1);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/RollingMachinePart2TileEntity.java b/src/main/java/ihl/processing/metallurgy/RollingMachinePart2TileEntity.java
new file mode 100644
index 0000000..13f4f6c
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/RollingMachinePart2TileEntity.java
@@ -0,0 +1,104 @@
+package ihl.processing.metallurgy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ic2.api.network.INetworkDataProvider;
+import ic2.api.tile.IWrenchable;
+import ic2.core.IC2;
+import ihl.utils.IHLUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+
+public class RollingMachinePart2TileEntity extends TileEntity implements IWrenchable, INetworkDataProvider{
+
+ private short facing=2;
+ private short lastFacing=2;
+
+ public RollingMachinePart2TileEntity()
+ {
+ super();
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = new ArrayList();
+ fields.add("facing");
+ return fields;
+ }
+
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+ if(lastFacing!=facing)
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ lastFacing=facing;
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=side;
+ }
+
+
+ @Override
+ public short getFacing() {
+ return this.facing;
+ }
+
+
+ @Override
+ public void setFacing(short facing1)
+ {
+ facing=(short) Math.max(2,facing1);
+ if(IC2.platform.isSimulating())
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
+ return true;
+ }
+
+
+ @Override
+ public float getWrenchDropRate() {
+ return 1F;
+ }
+
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("rollingMachinePart2");
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ facing=nbttagcompound.getShort("facing");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setShort("facing", facing);
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/RollingMachineRender.java b/src/main/java/ihl/processing/metallurgy/RollingMachineRender.java
new file mode 100644
index 0000000..f347a73
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/RollingMachineRender.java
@@ -0,0 +1,81 @@
+package ihl.processing.metallurgy;
+import org.lwjgl.opengl.GL11;
+
+import ic2.api.tile.IWrenchable;
+import ihl.IHLModInfo;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+
+public class RollingMachineRender extends TileEntitySpecialRenderer{
+private RollingMachinePart1Model model = new RollingMachinePart1Model();
+private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/coiler.png");
+private final float scale=1F/16F;
+
+ public RollingMachineRender() {}
+
+
+ @Override
+ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par8)
+ {
+ int rotation = 0;
+ if(tile.getWorldObj() != null)
+ {
+ switch (((IWrenchable)tile).getFacing())
+ {
+ case 2:
+ rotation = 0;
+ break;
+ case 5:
+ rotation = 1;
+ break;
+ case 3:
+ rotation = 2;
+ break;
+ case 4:
+ rotation = 3;
+ break;
+ default:
+ rotation = 0;
+ }
+ }
+ else
+ {
+ return;
+ }
+ RollingMachinePart1TileEntity cte = (RollingMachinePart1TileEntity)tile;
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
+ GL11.glScalef(1.0F, -1F, -1F);
+ GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F);
+
+ bindTexture(tex);
+ model.Base.render(scale);
+ if(cte.getActive())
+ {
+ model.RotatingPart1.rotateAngleZ-=0.01F;
+ model.RotatingPart2.rotateAngleZ+=0.01F;
+ model.RotatingPart1.render(scale);
+ model.RotatingPart2.render(scale);
+ model.MotorPart1.rotateAngleZ-=0.03F;
+ model.MotorPart1.render(scale);
+ model.MotorPart2.render(scale);
+ model.Plate.offsetX+=0.001F;
+ if(model.Plate.offsetX>1F){model.Plate.offsetX=0;}
+ model.Plate.render(scale);
+ }
+ else
+ {
+ model.Plate.offsetX=0F;
+ if(cte.assembled)
+ {
+ model.RotatingPart1.render(scale);
+ model.RotatingPart2.render(scale);
+ }
+ model.MotorPart1.render(scale);
+ model.MotorPart2.render(scale);
+ }
+ GL11.glPopMatrix(); //end
+
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ihl/processing/metallurgy/VulcanizationExtrudingMoldModel.java b/src/main/java/ihl/processing/metallurgy/VulcanizationExtrudingMoldModel.java
new file mode 100644
index 0000000..9ce0f01
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/VulcanizationExtrudingMoldModel.java
@@ -0,0 +1,54 @@
+package ihl.processing.metallurgy;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class VulcanizationExtrudingMoldModel extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+
+ public VulcanizationExtrudingMoldModel()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 0);
+ setTextureOffset("Base.Shape3", 0, 0);
+ setTextureOffset("Base.Shape16", 0, 0);
+ setTextureOffset("Base.PipeW161", 0, 0);
+ setTextureOffset("Base.PipeN16", 0, 0);
+ setTextureOffset("Base.PipeW15", 22, 22);
+ setTextureOffset("Base.PipeW17", 0, 0);
+ setTextureOffset("Base.Shape14", 0, 0);
+ setTextureOffset("Base.PipeN14", 0, 0);
+ setTextureOffset("Base.Shape2", 0, 0);
+ setTextureOffset("Base.Shape4", 42, 17);
+ setTextureOffset("Base.Shape5", 37, 17);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, -8F, 16, 1, 16);
+ Base.addBox("Shape3", -5F, 0F, -7F, 4, 7, 1);
+ Base.addBox("Shape16", 6.9F, 3F, -1.5F, 1, 4, 3);
+ Base.addTube("PipeW161", -7F, 0.5F, -1.5F, 15, 3, 3, 0.5F,1F,ForgeDirection.WEST);
+ Base.addTube("PipeN16", -4.5F, 0.5F, -6F, 3, 3, 6, 0.8F,1F,ForgeDirection.NORTH);
+ Base.addTube("PipeW15", -5.5F, -0.5F, -2.5F, 12, 5, 5, 0.5F,1F,ForgeDirection.WEST);
+ Base.addTube("PipeW17", -8F, -0.5F, -2.5F, 1, 5, 5, 0.1F,1F,ForgeDirection.WEST);
+ Base.addBox("Shape14", -5F, 3F, -4.9F, 4, 4, 1);
+ Base.addTube("PipeN14", -5.5F, -0.5F, -8F, 5, 5, 1, 0.5F,1F,ForgeDirection.NORTH);
+ Base.addBox("Shape2", -7F, 3F, -1.5F, 1, 4, 3);
+ Base.addBox("Shape4", 5F, 3F, 1F, 1, 4, 1);
+ Base.addBox("Shape5", 5F, 6F, 2F, 3, 1, 1);
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java b/src/main/java/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java
new file mode 100644
index 0000000..bb51ced
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/VulcanizationExtrudingMoldTileEntity.java
@@ -0,0 +1,256 @@
+package ihl.processing.metallurgy;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import ic2.api.energy.event.EnergyTileLoadEvent;
+import ic2.api.energy.event.EnergyTileUnloadEvent;
+import ic2.api.energy.tile.IEnergySink;
+import ic2.api.network.INetworkDataProvider;
+import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputItemStack;
+import ic2.api.tile.IWrenchable;
+import ic2.core.IC2;
+import ihl.items_blocks.FlexibleCableItem;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTank;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class VulcanizationExtrudingMoldTileEntity extends TileEntity
+ implements IWrenchable, INetworkDataProvider, IEnergySink, IProductionLine, IFluidHandler {
+
+ private short facing = 2;
+ private short lastFacing = 2;
+ public double energy;
+ public int maxStorage = 64;
+ private double energyConsume = 16D;
+ private boolean addedToEnergyNet = false;
+ private FluidTank fluidTank = new FluidTank(5000);
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager(
+ "vulcanizationextrudingmold");
+
+ public VulcanizationExtrudingMoldTileEntity() {
+ super();
+ }
+
+ public static void addRecipe(FluidStack inputFluid, ItemStack input, ItemStack output1) {
+ recipeManager.addRecipe(
+ new UniversalRecipeInput((new FluidStack[] { inputFluid }),
+ (new IRecipeInput[] { new RecipeInputItemStack(input) })),
+ new UniversalRecipeOutput(null, (new ItemStack[] { output1 }), 200));
+ }
+
+ public boolean enableUpdateEntity() {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public void invalidate() {
+ if (IC2.platform.isSimulating() && this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+ super.invalidate();
+ }
+
+ @Override
+ public List<String> getNetworkedFields() {
+ List<String> fields = new ArrayList<String>();
+ fields.add("facing");
+ return fields;
+ }
+
+ @Override
+ public void updateEntity() {
+ super.updateEntity();
+ if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+
+ if (lastFacing != facing) {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ lastFacing = facing;
+ }
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing() != side;
+ }
+
+ @Override
+ public short getFacing() {
+ return this.facing;
+ }
+
+ @Override
+ public void setFacing(short facing1) {
+ if (IC2.platform.isSimulating() && this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+ facing = (short) Math.max(2, facing1);
+ if (IC2.platform.isSimulating()) {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ lastFacing = facing;
+ }
+ if (IC2.platform.isSimulating() && !this.addedToEnergyNet) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+ this.addedToEnergyNet = true;
+ }
+ }
+
+ @Override
+ public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
+ return true;
+ }
+
+ @Override
+ public float getWrenchDropRate() {
+ return 1F;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("vulcanizationExtrudingMold");
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
+ facing = nbttagcompound.getShort("facing");
+ energy = nbttagcompound.getDouble("energy");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound fluidTankTag = new NBTTagCompound();
+ this.fluidTank.writeToNBT(fluidTankTag);
+ nbttagcompound.setTag("fluidTank", fluidTankTag);
+ nbttagcompound.setShort("facing", facing);
+ nbttagcompound.setDouble("energy", this.energy);
+ }
+
+ @Override
+ public double getDemandedEnergy() {
+ return this.maxStorage - this.energy;
+ }
+
+ @Override
+ public int getSinkTier() {
+ return 4;
+ }
+
+ @Override
+ public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) {
+ if (this.energy < this.maxStorage) {
+ this.energy += amount;
+ return 0.0D;
+ } else {
+ return amount;
+ }
+ }
+
+ @Override
+ public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) {
+ return true;
+ }
+
+ private ItemStack processWire(ItemStack wire, boolean doProcess) {
+ UniversalRecipeOutput rOutput = VulcanizationExtrudingMoldTileEntity.recipeManager.getOutputFor(
+ Arrays.asList(new FluidStack[] { this.fluidTank.getFluid() }), Arrays.asList(new ItemStack[] { wire }));
+ if (rOutput == null || this.energy < this.energyConsume) {
+ return wire;
+ }
+ UniversalRecipeInput rInput = VulcanizationExtrudingMoldTileEntity.recipeManager.getRecipeInput(
+ Arrays.asList(new FluidStack[] { this.fluidTank.getFluid() }), Arrays.asList(new ItemStack[] { wire }));
+ ItemStack cableAsRO = rOutput.getItemOutputs().get(0).itemStack;
+ ItemStack cable = wire.copy();
+ FlexibleCableItem fci = (FlexibleCableItem) cableAsRO.getItem();
+ cable.stackTagCompound.setString("insulationMaterial", fci.getInsulationMaterial(cableAsRO));
+ cable.stackTagCompound.setInteger("insulationThickness", fci.getInsulationThickness(cableAsRO));
+ cable.stackTagCompound.setInteger("maxVoltage", IHLUtils
+ .getInsulationMaxVoltage(fci.getInsulationMaterial(cableAsRO), fci.getInsulationThickness(cableAsRO)));
+ if (doProcess) {
+ this.energy -= this.energyConsume;
+ this.fluidTank.drain(rInput.getFluidInputs().get(0).getAmount() * IHLUtils.getWireLength(cable), true);
+ }
+ return cable;
+ }
+
+ @Override
+ public boolean canProcess(ItemStack wire) {
+ ItemStack cable = this.processWire(wire, false);
+ ForgeDirection dir = ForgeDirection.getOrientation(getFacing()).getRotation(ForgeDirection.UP);
+ TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
+ if (te instanceof IProductionLine) {
+ if (ForgeDirection.getOrientation(((IProductionLine) te).getFacing())
+ .equals(dir.getRotation(ForgeDirection.DOWN))) {
+ return ((IProductionLine) te).canProcess(cable);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void process(ItemStack wire) {
+ ItemStack cable = this.processWire(wire, true);
+ ForgeDirection dir = ForgeDirection.getOrientation(getFacing()).getRotation(ForgeDirection.UP);
+ TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
+ if (te instanceof IProductionLine && ForgeDirection.getOrientation(((IProductionLine) te).getFacing())
+ .equals(dir.getRotation(ForgeDirection.DOWN))) {
+ ((IProductionLine) te).process(cable);
+ }
+ }
+
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return false;
+ }
+
+ @Override
+ public boolean canFill(ForgeDirection arg0, Fluid arg1) {
+ return ForgeDirection.getOrientation(this.facing) == arg0;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return null;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection arg0, int arg1, boolean arg2) {
+ return null;
+ }
+
+ @Override
+ public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
+ return this.fluidTank.fill(arg1, arg2);
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
+ return new FluidTankInfo[] {this.fluidTank.getInfo()};
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/WireMillContainer.java b/src/main/java/ihl/processing/metallurgy/WireMillContainer.java
new file mode 100644
index 0000000..34f79de
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/WireMillContainer.java
@@ -0,0 +1,113 @@
+package ihl.processing.metallurgy;
+
+import java.util.List;
+
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraftforge.fluids.FluidStack;
+
+public class WireMillContainer extends ContainerBase<WireMillTileEntity> {
+
+ public WireMillTileEntity tileEntity;
+ public int lastProgress = -1;
+ private short lastEnergy = -1;
+ public int lastFluidAmount = -1;
+ public int lastNumberOfFluids = -1;
+ public int lastFluidAmount2 = -1;
+ public int lastNumberOfFluids2 = -1;
+ public int lastFluidAmount3 = -1;
+ public int lastNumberOfFluids3 = -1;
+ private final static int height=166;
+ public List<FluidStack> fluidTankFluidList;
+ public List<FluidStack> fluidTankFluidList2;
+ public List<FluidStack> fluidTankFluidList3;
+
+ public WireMillContainer(EntityPlayer entityPlayer,
+ WireMillTileEntity lathePart1TileEntity) {
+ super(lathePart1TileEntity);
+ tileEntity=lathePart1TileEntity;
+ fluidTankFluidList = this.tileEntity.waterFluidTank.getFluidList();
+ fluidTankFluidList2 = this.tileEntity.oilFluidTank.getFluidList();
+ fluidTankFluidList3 = this.tileEntity.metalFluidTank.getFluidList();
+ int col;
+
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.dice, 0, 99+18, 31));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.drainInputSlot, 0, 26+18, 14));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.fillInputSlot, 0, 26+18, 50));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.emptyFluidItemsSlot, 0, 26+18, 32));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity.dischargeSlot,0, 8, 14));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ if (this.tileEntity.progress != this.lastProgress)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+ if (this.tileEntity.getEnergy() != this.lastEnergy)
+ {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getEnergy());
+ }
+
+ if (this.tileEntity.waterFluidTank.getFluidAmount() != this.lastFluidAmount || this.tileEntity.waterFluidTank.getNumberOfFluids() != this.lastNumberOfFluids)
+ {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList");
+ }
+
+ if (this.tileEntity.oilFluidTank.getFluidAmount() != this.lastFluidAmount2 || this.tileEntity.oilFluidTank.getNumberOfFluids() != this.lastNumberOfFluids2)
+ {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList2");
+ }
+
+ if (this.tileEntity.metalFluidTank.getFluidAmount() != this.lastFluidAmount3 || this.tileEntity.metalFluidTank.getNumberOfFluids() != this.lastNumberOfFluids3)
+ {
+ IC2.network.get().sendContainerField(this, "fluidTankFluidList3");
+ }
+ }
+ this.lastNumberOfFluids = this.tileEntity.waterFluidTank.getNumberOfFluids();
+ this.lastFluidAmount = this.tileEntity.waterFluidTank.getFluidAmount();
+ this.lastNumberOfFluids2 = this.tileEntity.oilFluidTank.getNumberOfFluids();
+ this.lastFluidAmount2 = this.tileEntity.oilFluidTank.getFluidAmount();
+ this.lastNumberOfFluids3 = this.tileEntity.metalFluidTank.getNumberOfFluids();
+ this.lastFluidAmount3 = this.tileEntity.metalFluidTank.getFluidAmount();
+ this.lastProgress = this.tileEntity.progress;
+ this.lastEnergy = (short) this.tileEntity.getEnergy();
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+ switch (index)
+ {
+ case 0:
+ this.tileEntity.progress=(short) value;
+ break;
+ case 1:
+ this.tileEntity.setEnergy(value);
+ break;
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/WireMillGui.java b/src/main/java/ihl/processing/metallurgy/WireMillGui.java
new file mode 100644
index 0000000..8a3d583
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/WireMillGui.java
@@ -0,0 +1,68 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import ihl.utils.IHLRenderUtils;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+
+public class WireMillGui extends GuiContainer {
+
+ private WireMillContainer container;
+ protected static final ResourceLocation tex = new ResourceLocation("ihl", "textures/gui/GUIWireMill.png");
+
+ public WireMillGui(WireMillContainer latheContainer) {
+ super(latheContainer);
+ container = latheContainer;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(27, 15 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(18),18);
+ this.drawTexturedModalRect(134, 33, 198, 0, i1 + 1, 13);
+ }
+ if (this.container.tileEntity.oilFluidTank.getFluid()!=null && this.container.tileEntity.oilFluidTank.getFluidAmount() > 0)
+ {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.oilFluidTank, 81, 16, 93, 63, zLevel, par1, par2, xOffset, yOffset);
+ }
+ if (this.container.tileEntity.waterFluidTank.getFluid()!=null && this.container.tileEntity.waterFluidTank.getFluidAmount() > 0)
+ {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.waterFluidTank, 64, 16, 76, 63, zLevel, par1, par2, xOffset, yOffset);
+ }
+ if (this.container.tileEntity.metalFluidTank.getFluid()!=null && this.container.tileEntity.metalFluidTank.getFluidAmount() > 0)
+ {
+ IHLRenderUtils.instance.renderIHLFluidTank(this.container.tileEntity.metalFluidTank, 98, 16, 110, 63, zLevel, par1, par2, xOffset, yOffset);
+ }
+
+ this.mc.renderEngine.bindTexture(tex);
+ IHLRenderUtils.instance.drawTooltip(par1,par2,9,11,xOffset,yOffset,StatCollector.translateToLocal("ihl.wiremill.tip"));
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/WireMillTileEntity.java b/src/main/java/ihl/processing/metallurgy/WireMillTileEntity.java
new file mode 100644
index 0000000..d93eb4f
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/WireMillTileEntity.java
@@ -0,0 +1,378 @@
+package ihl.processing.metallurgy;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputOreDict;
+import ic2.core.ContainerBase;
+import ic2.core.block.invslot.InvSlot;
+import ic2.core.block.invslot.InvSlot.Access;
+import ic2.core.block.invslot.InvSlotConsumableLiquid;
+import ic2.core.block.invslot.InvSlotOutput;
+import ihl.IHLMod;
+import ihl.items_blocks.IHLTool;
+import ihl.processing.chemistry.ApparatusProcessableInvSlot;
+import ihl.processing.invslots.InvSlotConsumableLiquidIHL;
+import ihl.recipes.IRecipeInputFluid;
+import ihl.recipes.RecipeInputDie;
+import ihl.recipes.RecipeInputFluidDictionary;
+import ihl.recipes.RecipeInputFluidStack;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLFluidTank;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class WireMillTileEntity extends BasicElectricMotorTileEntity implements IFluidHandler{
+
+ public final ApparatusProcessableInvSlot dice;
+ public final InvSlotConsumableLiquidIHL fillInputSlot;
+ public final InvSlotConsumableLiquidIHL drainInputSlot;
+ public final InvSlotOutput emptyFluidItemsSlot;
+ public final IHLFluidTank oilFluidTank = new IHLFluidTank(1100);
+ public final IHLFluidTank waterFluidTank = new IHLFluidTank(1100);
+ public final IHLFluidTank metalFluidTank = new IHLFluidTank(1100);
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("wiremill");
+ protected static final UniversalRecipeManager recipeManagerMelting = new UniversalRecipeManager("wiremillMelting");
+
+ public WireMillTileEntity()
+ {
+ super();
+ emptyFluidItemsSlot = new InvSlotOutput(this, "emptyWaterFluidItemsSlot", 2, 1);
+ fillInputSlot = new InvSlotConsumableLiquidIHL(this, "fillInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Fill);
+ drainInputSlot = new InvSlotConsumableLiquidIHL(this, "drainInput", -1, InvSlot.Access.I, 1, InvSlot.InvSide.BOTTOM, InvSlotConsumableLiquid.OpType.Drain, "ingot");
+ dice = new ApparatusProcessableInvSlot(this, "dice", 3, Access.IO, 1, 64);
+ this.operationLength=600;
+ }
+
+
+ @Override
+ public String getInventoryName() {
+ return "WireMill";
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer player)
+ {
+ return IHLUtils.getThisModItemStack("wireMill");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1)
+ {
+ return new WireMillGui(new WireMillContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player)
+ {
+ return new WireMillContainer(player, this);
+ }
+
+ @Override
+ public void operate()
+ {
+ UniversalRecipeInput rInput = WireMillTileEntity.recipeManager.getRecipeInput(getInput());
+ IRecipeInput rInputDice = rInput.getItemInputs().get(0);
+ UniversalRecipeOutput rOutput = this.getOutput();
+ ItemStack rOutputItemStack=null;
+ if(!rOutput.getItemOutputs().isEmpty())
+ {
+ rOutputItemStack = rOutput.getItemOutputs().get(0).itemStack.copy();
+ }
+ List<IRecipeInputFluid> rInputFluidStacks = rInput.getFluidInputs();
+ int consumeMoltenMetalAmount=1;
+ if(!rInputFluidStacks.isEmpty() && rOutputItemStack!=null && rInputDice!=null && rInputDice instanceof RecipeInputDie)
+ {
+ if(rInputFluidStacks.size()>=3)
+ {
+ consumeMoltenMetalAmount=rInputFluidStacks.get(2).getAmount();
+ }
+ else
+ {
+ consumeMoltenMetalAmount=rInputFluidStacks.get(0).getAmount();
+ }
+ if(rOutputItemStack!=null && rInputDice!=null && rInputDice instanceof RecipeInputDie)
+ {
+ consumeMoltenMetalAmount*=((RecipeInputDie)rInputDice).transformOutput(this.dice.get(), rOutputItemStack);
+ }
+ }
+ if(dice.get()!=null)
+ {
+ if(dice.get().getItem() instanceof IHLTool)
+ {
+ IHLUtils.damageItemViaNBTTag(dice.get(), 1);
+ if(dice.get().stackSize<=0)
+ {
+ dice.put(null);
+ }
+ }
+ else
+ {
+ dice.consume(rInputDice);
+ }
+ }
+ if(this.drainInputSlot.get()!=null && !rInput.getItemInputs().isEmpty() && rInput.getItemInputs().get(0).matches(this.drainInputSlot.get()))
+ {
+ this.drainInputSlot.consume(1);
+ }
+ if(!rOutput.getFluidOutputs().isEmpty())
+ {
+ this.metalFluidTank.fill(rOutput.getFluidOutputs().get(0), true);
+ }
+ TileEntity te = worldObj.getTileEntity(xCoord+ForgeDirection.getOrientation(getFacing()).offsetX,yCoord+ForgeDirection.getOrientation(getFacing()).offsetY,zCoord+ForgeDirection.getOrientation(getFacing()).offsetZ);
+ if(rOutputItemStack!=null && te instanceof IProductionLine)
+ {
+ if(!rInputFluidStacks.isEmpty())
+ {
+ this.oilFluidTank.drain(1, true);
+ this.waterFluidTank.drain(1, true);
+ this.metalFluidTank.drain(consumeMoltenMetalAmount, true);
+ }
+ ((IProductionLine)te).process(rOutputItemStack);
+ }
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public List[] getInput()
+ {
+ return new List[]{Arrays.asList(new FluidStack[] {this.oilFluidTank.getFluid(),this.waterFluidTank.getFluid(),this.metalFluidTank.getFluid()}),Arrays.asList(new ItemStack[] {dice.get(),drainInputSlot.get()})};
+ }
+
+ public UniversalRecipeOutput getOutput()
+ {
+ return WireMillTileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ public static void addRecipe(FluidStack moltenMetal, IRecipeInput inputDice,ItemStack output1)
+ {
+ recipeManager.addRecipe(new UniversalRecipeInput((new IRecipeInputFluid[] {new RecipeInputFluidDictionary("lubricant", 1),new RecipeInputFluidDictionary("water", 1),new RecipeInputFluidStack(moltenMetal)}),(new IRecipeInput[] {inputDice})),new UniversalRecipeOutput(null,(new ItemStack[] {output1}),200));
+ }
+
+ public static void addRecipe(String string, FluidStack fluidStack)
+ {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput [] {new RecipeInputOreDict(string)})),new UniversalRecipeOutput((new FluidStack[] {fluidStack}),null,200));
+ }
+
+
+ @Override
+ public boolean canOperate()
+ {
+ UniversalRecipeOutput output = this.getOutput();
+ if(output!=null)
+ {
+ ForgeDirection dir = ForgeDirection.getOrientation(getFacing()).getRotation(ForgeDirection.DOWN);
+ TileEntity te = worldObj.getTileEntity(xCoord+ForgeDirection.getOrientation(getFacing()).offsetX,yCoord+ForgeDirection.getOrientation(getFacing()).offsetY,zCoord+ForgeDirection.getOrientation(getFacing()).offsetZ);
+ if(te instanceof IProductionLine && !output.getItemOutputs().isEmpty())
+ {
+ ItemStack isOut=this.getOutput().getItemOutputs().get(0).itemStack.copy();
+ if(this.dice.get()!=null)
+ {
+ isOut.stackTagCompound.setInteger("transverseSection", this.dice.get().stackTagCompound.getInteger("transverseSection"));
+ }
+ return ForgeDirection.getOrientation(((IProductionLine)te).getFacing()).equals(dir) && ((IProductionLine)te).canProcess(isOut);
+ }
+ else if(!output.getFluidOutputs().isEmpty())
+ {
+ FluidStack fstack = output.getFluidOutputs().get(0);
+ return metalFluidTank.fill(fstack, false)==fstack.amount;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ this.oilFluidTank.readFromNBT(nbttagcompound.getCompoundTag("oilFluidTank"));
+ this.waterFluidTank.readFromNBT(nbttagcompound.getCompoundTag("waterFluidTank"));
+ this.metalFluidTank.readFromNBT(nbttagcompound.getCompoundTag("metalFluidTank"));
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound oilFluidTankTag = new NBTTagCompound();
+ this.oilFluidTank.writeToNBT(oilFluidTankTag);
+ nbttagcompound.setTag("oilFluidTank", oilFluidTankTag);
+ NBTTagCompound waterFluidTankTag = new NBTTagCompound();
+ this.waterFluidTank.writeToNBT(waterFluidTankTag);
+ nbttagcompound.setTag("waterFluidTank", waterFluidTankTag);
+ NBTTagCompound metalFluidTankTag = new NBTTagCompound();
+ this.metalFluidTank.writeToNBT(metalFluidTankTag);
+ nbttagcompound.setTag("metalFluidTank", metalFluidTankTag);
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ FluidStack drainSlotContent = drainInputSlot.drain(null, Integer.MAX_VALUE, null, true);
+ if(drainSlotContent!=null)
+ {
+ String fluidDictionaryName = IHLMod.fluidDictionary.getFluidName(drainSlotContent.getFluid());
+ if(fluidDictionaryName!=null && fluidDictionaryName.equals("lubricant"))
+ {
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, oilFluidTank);
+ }
+ else if(fluidDictionaryName!=null && fluidDictionaryName.equals("water"))
+ {
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, waterFluidTank);
+ }
+ else
+ {
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, metalFluidTank);
+ }
+ }
+ else
+ {
+ if(metalFluidTank.getNumberOfFluids()>0)
+ {
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, metalFluidTank);
+ }
+ else if(oilFluidTank.getNumberOfFluids()>0)
+ {
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, oilFluidTank);
+ }
+ else
+ {
+ IHLUtils.handleFluidSlotsBehaviour(fillInputSlot, drainInputSlot, emptyFluidItemsSlot, waterFluidTank);
+ }
+ }
+
+ }
+ public int gaugeLiquidScaled(int i) {
+ if(this.oilFluidTank.getFluid()!=null)
+ {
+ return this.oilFluidTank.getFluidAmount() * i /this.oilFluidTank.getCapacity();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ @Override
+ public int gaugeProgressScaled(int i)
+ {
+ return this.progress * i / this.operationLength;
+ }
+
+ public int gaugeWaterScaled(int i)
+ {
+ if(this.waterFluidTank.getFluid()!=null)
+ {
+ return this.waterFluidTank.getFluidAmount() * i /this.waterFluidTank.getCapacity();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes()
+ {
+ return recipeManager.getRecipes();
+ }
+
+
+ @Override
+ public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
+ return true;
+ }
+
+
+ @Override
+ public boolean canFill(ForgeDirection arg0, Fluid arg1) {
+ return true;
+ }
+
+
+ @Override
+ public FluidStack drain(ForgeDirection direction, FluidStack arg1, boolean arg2)
+ {
+ if(direction.equals(ForgeDirection.DOWN))
+ {
+ return this.metalFluidTank.drain(arg1, arg2);
+ }
+ else if(direction.equals(ForgeDirection.UP))
+ {
+ return this.waterFluidTank.drain(arg1, arg2);
+ }
+ else
+ {
+ return this.oilFluidTank.drain(arg1, arg2);
+ }
+ }
+
+
+ @Override
+ public FluidStack drain(ForgeDirection direction, int arg1, boolean arg2)
+ {
+ if(direction.equals(ForgeDirection.DOWN))
+ {
+ return this.metalFluidTank.drain(arg1, arg2);
+ }
+ else if(direction.equals(ForgeDirection.UP))
+ {
+ return this.waterFluidTank.drain(arg1, arg2);
+ }
+ else
+ {
+ return this.oilFluidTank.drain(arg1, arg2);
+ }
+ }
+
+
+ @Override
+ public int fill(ForgeDirection direction, FluidStack arg1, boolean arg2)
+ {
+ if(direction.equals(ForgeDirection.DOWN))
+ {
+ return this.metalFluidTank.fill(arg1, arg2);
+ }
+ else if(direction.equals(ForgeDirection.UP))
+ {
+ return this.waterFluidTank.fill(arg1, arg2);
+ }
+ else
+ {
+ return this.oilFluidTank.fill(arg1, arg2);
+ }
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(ForgeDirection direction)
+ {
+ if(direction.equals(ForgeDirection.DOWN))
+ {
+ return new FluidTankInfo[] {this.metalFluidTank.getInfo()};
+ }
+ else if(direction.equals(ForgeDirection.UP))
+ {
+ return new FluidTankInfo[] {this.waterFluidTank.getInfo()};
+ }
+ else
+ {
+ return new FluidTankInfo[] {this.oilFluidTank.getInfo()};
+ }
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/WoodenRollingMachineContainer.java b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachineContainer.java
new file mode 100644
index 0000000..ba191f8
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachineContainer.java
@@ -0,0 +1,77 @@
+package ihl.processing.metallurgy;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class WoodenRollingMachineContainer extends ContainerBase<WoodenRollingMachinePart1TileEntity> {
+
+ public WoodenRollingMachinePart1TileEntity tileEntity;
+ public int lastProgress = -1;
+ private short lastEnergy = -1;
+ private final static int height=166;
+
+ public WoodenRollingMachineContainer(EntityPlayer entityPlayer,
+ WoodenRollingMachinePart1TileEntity lathePart1TileEntity) {
+ super(lathePart1TileEntity);
+ tileEntity=lathePart1TileEntity;
+ int col;
+
+ for (col = 0; col < 3; ++col)
+ {
+ for (int col1 = 0; col1 < 9; ++col1)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18));
+ }
+ }
+
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24));
+ }
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.output, 0, 54, 25));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.input, 0, 123, 15));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.input, 1, 123, 34));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.input, 2, 123, 53));
+ this.addSlotToContainer(new SlotInvSlot(lathePart1TileEntity.dischargeSlot,0, 22, 55));
+ }
+
+ @Override
+ public void detectAndSendChanges()
+ {
+ super.detectAndSendChanges();
+ for (int i = 0; i < this.crafters.size(); ++i)
+ {
+ ICrafting icrafting = (ICrafting)this.crafters.get(i);
+ if (this.tileEntity.progress != this.lastProgress)
+ {
+ icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
+ }
+ if (this.tileEntity.getEnergy() != this.lastEnergy)
+ {
+ icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.getEnergy());
+ }
+ }
+ this.lastProgress = this.tileEntity.progress;
+ this.lastEnergy = (short) this.tileEntity.getEnergy();
+ }
+
+ @Override
+ public void updateProgressBar(int index, int value)
+ {
+ super.updateProgressBar(index, value);
+
+ switch (index)
+ {
+ case 0:
+ this.tileEntity.progress=(short) value;
+ break;
+ case 1:
+ this.tileEntity.setEnergy(value);
+ break;
+ }
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/WoodenRollingMachineGui.java b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachineGui.java
new file mode 100644
index 0000000..085dae5
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachineGui.java
@@ -0,0 +1,60 @@
+package ihl.processing.metallurgy;
+
+import org.lwjgl.opengl.GL11;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+
+public class WoodenRollingMachineGui extends GuiContainer {
+
+ private WoodenRollingMachineContainer container;
+ protected static final ResourceLocation tex = new ResourceLocation("ihl", "textures/gui/GUIWoodenRollingMachine.png");
+
+ public WoodenRollingMachineGui(WoodenRollingMachineContainer latheContainer) {
+ super(latheContainer);
+ container = latheContainer;
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int i1;
+ if (this.container.tileEntity.getEnergy() > 0D)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.getGUIEnergy(12),12);
+ this.drawTexturedModalRect(39, 55 + 12 - i1, 179, 12 - i1, 14, i1 + 2);
+ }
+ if (this.container.tileEntity.progress > 0)
+ {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ i1 = Math.min(this.container.tileEntity.gaugeProgressScaled(27),27);
+ this.drawTexturedModalRect(18, 22, getFrameX(i1), getFrameY(i1),24,24);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ //draw your Gui here, only thing you need to change is the path
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(tex);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+ private int getFrameY(int number)
+ {
+ return (number % 10) * 24 + 14;
+ }
+
+ private int getFrameX(int number)
+ {
+ return (number / 10) * 24 + 176;
+ }
+}
diff --git a/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart1Model.java b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart1Model.java
new file mode 100644
index 0000000..ac7799b
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart1Model.java
@@ -0,0 +1,122 @@
+// Date: 15.02.2015 11:28:39
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+
+package ihl.processing.metallurgy;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class WoodenRollingMachinePart1Model extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+ IHLModelRenderer RotatingPart2;
+ IHLModelRenderer MotorPart1;
+ IHLModelRenderer MotorPart2;
+ IHLModelRenderer RotatingPart1;
+ IHLModelRenderer RotatingPart3;
+ IHLModelRenderer RotatingPart4;
+ IHLModelRenderer Belt1;
+ IHLModelRenderer Belt2;
+
+ public WoodenRollingMachinePart1Model()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 15);
+ setTextureOffset("Base.Shape16", 0, 23);
+ setTextureOffset("Base.PipeN18", 0, 0);
+ setTextureOffset("Base.PipeN19", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN17", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN21", 0, 0);
+ setTextureOffset("RotatingPart2.PipeN25", 0, 0);
+ setTextureOffset("MotorPart1.PipeN41", 0, 0);
+ setTextureOffset("MotorPart1.PipeN13", 0, 0);
+ setTextureOffset("MotorPart1.PipeN12", 0, 0);
+ setTextureOffset("MotorPart1.PipeN16", 0, 0);
+ setTextureOffset("MotorPart2.Shape4", 0, 24);
+ setTextureOffset("MotorPart2.Shape7", 0, 9);
+ setTextureOffset("MotorPart2.Shape10", 0, 9);
+ setTextureOffset("RotatingPart1.PipeN27", 0, 0);
+ setTextureOffset("RotatingPart1.PipN119", 0, 0);
+ setTextureOffset("RotatingPart1.pipeN24", 0, 0);
+ setTextureOffset("RotatingPart3.PipeN23", 0, 0);
+ setTextureOffset("RotatingPart3.PipeN22", 0, 0);
+ setTextureOffset("RotatingPart3.PipeN26", 0, 0);
+ setTextureOffset("RotatingPart4.PipeN28", 0, 0);
+ setTextureOffset("Belt1.Shape12", 60, 0);
+ setTextureOffset("Belt2.Shape17", 60, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, -8F, 16, 1, 16);
+ Base.addBox("Shape16", -6F, -1F, -7F, 12, 8, 1);
+ Base.addTube("PipeN18", -5F, -6.1F, -7.1F, 10, 10, 1, 0.9F,1F,ForgeDirection.NORTH);
+ Base.addTube("PipeN19", -1.5F, -6F, -7F, 3, 3, 1, 0.25F,1F,ForgeDirection.NORTH);;
+ RotatingPart2 = new IHLModelRenderer(this, "RotatingPart2");
+ RotatingPart2.setRotationPoint(-2.2F, 16F, -8F);
+ setRotation(RotatingPart2, 0F, 0F, 0F);
+ RotatingPart2.mirror = true;
+ RotatingPart2.addTube("PipeN17", -2F, -2F, 2F, 4, 4, 28, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("PipeN21", -0.5F, -0.5F, 0F, 1, 1, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart2.addTube("PipeN25", -0.5F, -0.5F, 30F, 1, 1, 2, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1 = new IHLModelRenderer(this, "MotorPart1");
+ MotorPart1.setRotationPoint(4.5F, 20.5F, 0F);
+ setRotation(MotorPart1, 0F, 0F, 0F);
+ MotorPart1.mirror = true;
+ MotorPart1.addTube("PipeN41", -1.5F, -1.5F, -8F, 3, 3, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN12", -0.5F, -0.5F, -7F, 1, 1, 1, 0F,1F,ForgeDirection.NORTH);
+ MotorPart1.addTube("PipeN13", -1.5F, -1.5F, -5F, 3, 3, 5, 0F,1F,ForgeDirection.NORTH);
+ MotorPart2 = new IHLModelRenderer(this, "MotorPart2");
+ MotorPart2.setRotationPoint(0F, 16F, 0F);
+ setRotation(MotorPart2, 0F, 0F, 0F);
+ MotorPart2.mirror = true;
+ MotorPart2.addBox("Shape4", 3F, 3F, 0F, 3, 4, 4);
+ MotorPart2.addBox("Shape7", 6F, 3F, -5F, 2, 4, 5);
+ MotorPart2.addBox("Shape10", 1F, 3F, -5F, 2, 4, 5);
+ RotatingPart1 = new IHLModelRenderer(this, "RotatingPart1");
+ RotatingPart1.setRotationPoint(0F, 11.5F, -6F);
+ setRotation(RotatingPart1, 0F, 0F, 0F);
+ RotatingPart1.mirror = true;
+ RotatingPart1.addTube("PipeN27", -2F, -2F, 0F, 4, 4, 28, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart1.addTube("PipN119", -0.5F, -0.5F, -2F, 1, 1, 2, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart1.addTube("pipeN24", -0.5F, -0.5F, 28F, 1, 1, 2, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart3 = new IHLModelRenderer(this, "RotatingPart3");
+ RotatingPart3.setRotationPoint(2.2F, 16F, -8F);
+ setRotation(RotatingPart3, 0F, 0F, 0F);
+ RotatingPart3.mirror = true;
+ RotatingPart3.addTube("PipeN23", -2F, -2F, 2F, 4, 4, 28, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart3.addTube("PipeN22", -1.5F, -1.5F, 0F, 3, 3, 1, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart3.addTube("PipeN26", -0.5F, -0.5F, 30F, 1, 1, 2, 0F,1F,ForgeDirection.NORTH);
+ RotatingPart4 = new IHLModelRenderer(this, "RotatingPart4");
+ RotatingPart4.setRotationPoint(0F, 15F, -5F);
+ setRotation(RotatingPart3, 0F, 0F, 0F);
+ RotatingPart4.mirror = true;
+ RotatingPart4.addTube("PipeN28", -0.5F, -0.5F, 0F, 1, 1, 27, 0F,1F,ForgeDirection.NORTH);
+ Belt1 = new IHLModelRenderer(this, "Belt1");
+ Belt1.setRotationPoint(2.5F, 16F, -7.9F);
+ setRotation(Belt1, 0F, 0F, -0.45F);
+ Belt1.mirror = true;
+ Belt1.addBox("Shape12", 0F, 0F, 0F, 1, 5, 1);
+ Belt2 = new IHLModelRenderer(this, "Belt2");
+ Belt2.setRotationPoint(2F, 16F, -7.9F);
+ setRotation(Belt2, 0F, 0F, -0.45F);
+ Belt2.mirror = true;
+ Belt2.addBox("Shape17", -1F, 0F, 0F, 1, 6, 1);
+ }
+
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java
new file mode 100644
index 0000000..857575a
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart1TileEntity.java
@@ -0,0 +1,158 @@
+package ihl.processing.metallurgy;
+
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputItemStack;
+import ic2.api.recipe.RecipeInputOreDict;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.block.invslot.InvSlot.Access;
+import ihl.processing.chemistry.ApparatusProcessableInvSlot;
+import ihl.processing.invslots.IHLInvSlotOutput;
+import ihl.recipes.RecipeOutputItemStack;
+import ihl.recipes.UniversalRecipeInput;
+import ihl.recipes.UniversalRecipeManager;
+import ihl.recipes.UniversalRecipeOutput;
+import ihl.utils.IHLUtils;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class WoodenRollingMachinePart1TileEntity extends BasicElectricMotorTileEntity{
+
+ public final ApparatusProcessableInvSlot input;
+ public final IHLInvSlotOutput output;
+ public boolean assembled;
+ protected static final UniversalRecipeManager recipeManager = new UniversalRecipeManager("woodenrollingmachine");
+
+ public WoodenRollingMachinePart1TileEntity()
+ {
+ super();
+ input = new ApparatusProcessableInvSlot(this, "input", 1, Access.IO, 3, 64);
+ output = new IHLInvSlotOutput(this, "output", 2, 1);
+ }
+
+ public UniversalRecipeOutput getOutput()
+ {
+ return WoodenRollingMachinePart1TileEntity.recipeManager.getOutputFor(this.getInput());
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = super.getNetworkedFields();
+ fields.add("assembled");
+ return fields;
+ }
+
+
+ @Override
+ public String getInventoryName() {
+ return "WoodenRollingMachine";
+ }
+
+ @Override
+ public void updateEntityServer()
+ {
+ super.updateEntityServer();
+ if(assembled && !this.checkCorrectAccembly())
+ {
+ assembled=false;
+ IC2.network.get().updateTileEntityField(this, "assembled");
+ }
+ else if(!assembled && this.checkCorrectAccembly())
+ {
+ assembled=true;
+ IC2.network.get().updateTileEntityField(this, "assembled");
+ }
+ if (this.getActive() && this.progress == 0 && !this.canOperate())
+ {
+ this.setActive(false);
+ }
+
+ if (!this.getActive() && this.progress>0 && this.canOperate())
+ {
+ this.setActive(true);
+ }
+
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer player)
+ {
+ return IHLUtils.getThisModItemStack("woodenRollingMachinePart1");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer player, boolean arg1) {
+ return new WoodenRollingMachineGui(new WoodenRollingMachineContainer(player, this));
+ }
+
+ @Override
+ public ContainerBase<?> getGuiContainer(EntityPlayer player) {
+ return new WoodenRollingMachineContainer(player, this);
+ }
+
+ @Override
+ public void operate()
+ {
+ List<IRecipeInput> rInput = WoodenRollingMachinePart1TileEntity.recipeManager.getRecipeInput(getInput()).getItemInputs();
+ List<RecipeOutputItemStack> rOutput = WoodenRollingMachinePart1TileEntity.recipeManager.getOutputFor(getInput()).getItemOutputs();
+ this.output.add(rOutput);
+ for(int i=0;i<rInput.size();i++)
+ {
+ this.input.consume(rInput.get(i));
+ }
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public List[] getInput()
+ {
+ return new List[]{null, input.getItemStackList()};
+ }
+
+ @Override
+ public boolean canOperate()
+ {
+ return this.getOutput()!=null && this.output.canAdd(this.getOutput().getItemOutputs()) && checkCorrectAccembly();
+ }
+
+ private boolean checkCorrectAccembly()
+ {
+ TileEntity te = worldObj.getTileEntity(xCoord+ForgeDirection.getOrientation(getFacing()).offsetX,yCoord+ForgeDirection.getOrientation(getFacing()).offsetY,zCoord+ForgeDirection.getOrientation(getFacing()).offsetZ);
+ return te!=null && te instanceof WoodenRollingMachinePart2TileEntity && ((WoodenRollingMachinePart2TileEntity)te).getFacing()==this.getFacing();
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer arg0) {}
+
+ public static void addRecipe(RecipeInputItemStack recipeInputItemStack, RecipeInputItemStack recipeInputItemStack2, RecipeInputOreDict recipeInputOreDict, ItemStack output)
+ {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] {recipeInputItemStack,recipeInputItemStack2,recipeInputOreDict})), new UniversalRecipeOutput(null,(new ItemStack[] {output}),20));
+ }
+
+
+ public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
+ return recipeManager.getRecipes();
+ }
+
+ public static void addRecipe(RecipeInputOreDict recipeInputOreDict, RecipeInputOreDict recipeInputOreDict2, ItemStack output)
+ {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput[] {recipeInputOreDict,recipeInputOreDict2})), new UniversalRecipeOutput(null,(new ItemStack[] {output}),20));
+ }
+
+ @Override
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass==0;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart2Model.java b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart2Model.java
new file mode 100644
index 0000000..6ebc58e
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart2Model.java
@@ -0,0 +1,44 @@
+// Date: 15.02.2015 11:31:12
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+
+package ihl.processing.metallurgy;
+
+import ihl.model.IHLModelRenderer;
+import net.minecraft.client.model.ModelBase;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class WoodenRollingMachinePart2Model extends ModelBase
+{
+ //fields
+ IHLModelRenderer Base;
+
+ public WoodenRollingMachinePart2Model()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ setTextureOffset("Base.Shape6", 0, 15);
+ setTextureOffset("Base.Shape16", 0, 23);
+ setTextureOffset("Base.PipeN18", 0, 0);
+ setTextureOffset("Base.PipeN19", 0, 0);
+
+ Base = new IHLModelRenderer(this, "Base");
+ Base.setRotationPoint(0F, 16F, 0F);
+ setRotation(Base, 0F, 0F, 0F);
+ Base.mirror = true;
+ Base.addBox("Shape6", -8F, 7F, -8F, 16, 1, 16);
+ Base.addBox("Shape16", -6F, -1F, 6F, 12, 8, 1);
+ Base.addTube("PipeN18", -5F, -6.1F, 6.1F, 10, 10, 1, 0.9F,1F,ForgeDirection.NORTH);
+ Base.addTube("PipeN19", -1.5F, -6F, 6F, 3, 3, 1, 0.25F,1F,ForgeDirection.NORTH);;
+ }
+
+ private void setRotation(IHLModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart2TileEntity.java b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart2TileEntity.java
new file mode 100644
index 0000000..9aec41b
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachinePart2TileEntity.java
@@ -0,0 +1,104 @@
+package ihl.processing.metallurgy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ic2.api.network.INetworkDataProvider;
+import ic2.api.tile.IWrenchable;
+import ic2.core.IC2;
+import ihl.utils.IHLUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+
+public class WoodenRollingMachinePart2TileEntity extends TileEntity implements IWrenchable, INetworkDataProvider{
+
+ private short facing=2;
+ private short lastFacing=2;
+
+ public WoodenRollingMachinePart2TileEntity()
+ {
+ super();
+ }
+
+ public boolean enableUpdateEntity()
+ {
+ return IC2.platform.isSimulating();
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> fields = new ArrayList();
+ fields.add("facing");
+ return fields;
+ }
+
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+ if(lastFacing!=facing)
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ lastFacing=facing;
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=side;
+ }
+
+
+ @Override
+ public short getFacing() {
+ return this.facing;
+ }
+
+
+ @Override
+ public void setFacing(short facing1)
+ {
+ facing=(short) Math.max(2,facing1);
+ if(IC2.platform.isSimulating())
+ {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ }
+ }
+
+
+ @Override
+ public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
+ return true;
+ }
+
+
+ @Override
+ public float getWrenchDropRate() {
+ return 1F;
+ }
+
+
+ @Override
+ public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
+ return IHLUtils.getThisModItemStack("woodenRollingMachinePart2");
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbttagcompound)
+ {
+ super.readFromNBT(nbttagcompound);
+ facing=nbttagcompound.getShort("facing");
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound)
+ {
+ super.writeToNBT(nbttagcompound);
+ nbttagcompound.setShort("facing", facing);
+ }
+
+}
diff --git a/src/main/java/ihl/processing/metallurgy/WoodenRollingMachineRender.java b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachineRender.java
new file mode 100644
index 0000000..f180f75
--- /dev/null
+++ b/src/main/java/ihl/processing/metallurgy/WoodenRollingMachineRender.java
@@ -0,0 +1,91 @@
+package ihl.processing.metallurgy;
+import org.lwjgl.opengl.GL11;
+
+import ic2.api.tile.IWrenchable;
+import ihl.IHLModInfo;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+
+public class WoodenRollingMachineRender extends TileEntitySpecialRenderer{
+private WoodenRollingMachinePart1Model model = new WoodenRollingMachinePart1Model();
+private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/woodenRollingMachine.png");
+private final float scale=1F/16F;
+
+ public WoodenRollingMachineRender() {}
+
+
+ @Override
+ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par8)
+ {
+ int rotation = 0;
+ if(tile.getWorldObj() != null)
+ {
+ switch (((IWrenchable)tile).getFacing())
+ {
+ case 2:
+ rotation = 0;
+ break;
+ case 5:
+ rotation = 1;
+ break;
+ case 3:
+ rotation = 2;
+ break;
+ case 4:
+ rotation = 3;
+ break;
+ default:
+ rotation = 0;
+ }
+ }
+ else
+ {
+ return;
+ }
+ WoodenRollingMachinePart1TileEntity cte = (WoodenRollingMachinePart1TileEntity)tile;
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
+ GL11.glScalef(1.0F, -1F, -1F);
+ GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F);
+
+ bindTexture(tex);
+ model.Base.render(scale);
+ if(cte.getActive())
+ {
+ model.RotatingPart1.rotateAngleZ+=0.01F;
+ model.RotatingPart2.rotateAngleZ+=0.01F;
+ model.RotatingPart3.rotateAngleZ+=0.01F;
+ model.RotatingPart4.rotateAngleZ-=0.01F;
+ model.RotatingPart1.render(scale);
+ model.RotatingPart2.render(scale);
+ model.RotatingPart3.render(scale);
+ model.RotatingPart4.render(scale);
+ model.MotorPart1.rotateAngleZ-=0.03F;
+ model.MotorPart1.render(scale);
+ model.MotorPart2.render(scale);
+ model.Belt1.render(scale);
+ model.Belt2.render(scale);
+ }
+ else
+ {
+ model.RotatingPart1.rotateAngleZ=0.0F;
+ model.RotatingPart2.rotateAngleZ=0.0F;
+ model.RotatingPart3.rotateAngleZ=0.0F;
+ model.RotatingPart4.rotateAngleZ=0.0F;
+ if(cte.assembled)
+ {
+ model.RotatingPart1.render(scale);
+ model.RotatingPart2.render(scale);
+ model.RotatingPart3.render(scale);
+ model.RotatingPart4.render(scale);
+ }
+ model.MotorPart1.render(scale);
+ model.MotorPart2.render(scale);
+ model.Belt1.render(scale);
+ model.Belt2.render(scale);
+ }
+ GL11.glPopMatrix(); //end
+
+ }
+} \ No newline at end of file