diff options
| author | Foghrye4 <foghrye4@gmail.com> | 2017-02-12 20:43:03 +0300 |
|---|---|---|
| committer | Foghrye4 <foghrye4@gmail.com> | 2017-02-12 20:43:03 +0300 |
| commit | 5cb4c6e24033cf337812390d99a6817d24d21eab (patch) | |
| tree | 695789855920199efd4702a7bb3e4bacfe58b9f0 /ihl/processing | |
| parent | 8f22398517206aed21a7fd840f463332429fae35 (diff) | |
Removed explosion radius limitations. Explosion calculation optimized (reduced memory usage). One more detonator and explosive pack recipe. GT6 recipes for both chemical reactors and cryogenic distiller. Max stack size of muffle furnace is limited to 32. A lot of old features are removed.
Diffstat (limited to 'ihl/processing')
9 files changed, 137 insertions, 760 deletions
diff --git a/ihl/processing/chemistry/ElectrolysisBathGui.java b/ihl/processing/chemistry/ElectrolysisBathGui.java index a7788a5..89b8ddb 100644 --- a/ihl/processing/chemistry/ElectrolysisBathGui.java +++ b/ihl/processing/chemistry/ElectrolysisBathGui.java @@ -8,7 +8,8 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
-import ihl.collector.GuiMultiTextureButton;
+
+import ihl.utils.GuiMultiTextureButton;
import ihl.utils.IHLRenderUtils;
@SideOnly(Side.CLIENT)
diff --git a/ihl/processing/invslots/InvSlotSignalProcessor.java b/ihl/processing/invslots/InvSlotSignalProcessor.java deleted file mode 100644 index f66ab13..0000000 --- a/ihl/processing/invslots/InvSlotSignalProcessor.java +++ /dev/null @@ -1,123 +0,0 @@ -package ihl.processing.invslots;
-
-import net.minecraft.block.Block;
-import net.minecraftforge.common.util.ForgeDirection;
-import ic2.core.Ic2Items;
-import ic2.core.block.invslot.InvSlot;
-import ihl.datanet.Contact;
-import ihl.datanet.RedstoneSignalConverterTileEntity;
-import ihl.interfaces.IDataNode;
-import ihl.utils.IHLUtils;
-
-public class InvSlotSignalProcessor extends InvSlot
-{
- private RedstoneSignalConverterTileEntity rscBase;
- public final boolean[] slotStatus;//false=normal;true=activated
- public InvSlotSignalProcessor(RedstoneSignalConverterTileEntity base1, String name1, int oldStartIndex1, Access access1, int count, int linksPerSlot) {
- super(base1, name1, oldStartIndex1, access1, count);
- rscBase = base1;
- slotStatus = new boolean[count];
- }
-
- public Contact getOppositeContact(IDataNode contact3)
- {
- for(Contact contact1 : this.rscBase.contacts)
- {
- if(contact1.attachedSlot==this &&
- contact3.getAttachedSlotNumber()==contact1.attachedSlotNumber)
- {
- switch(contact3.getType())
- {
- case 0:
- if(contact1.type==1)
- {
- return contact1;
- }
- break;
- case 1:
- if(contact1.type==0)
- {
- return contact1;
- }
- break;
- case 2:
- if(slotStatus[contact1.attachedSlotNumber])
- {
- if(contact1.type==3)
- {
- return contact1;
- }
- }
- else
- {
- if(contact1.type==4)
- {
- return contact1;
- }
- }
- break;
- case 3:
- if(slotStatus[contact1.attachedSlotNumber])
- {
- if(contact1.type==2)
- {
- return contact1;
- }
- }
- break;
- case 4:
- if(!slotStatus[contact1.attachedSlotNumber])
- {
- if(contact1.type==2)
- {
- return contact1;
- }
- }
- break;
- }
- }
- }
- return null;
- }
-
- public boolean isSlotActivated(int slot)
- {
- return this.slotStatus[slot];
- }
-
- public void notifyNeighbors()
- {
- int xyz[] = {0,0,1,0,0,-1,0,0};
- Block block;
- int x,y,z;
- for(int i=0;i<=5;i++)
- {
- x=rscBase.xCoord+xyz[i];
- y=rscBase.yCoord+xyz[i+1];
- z=rscBase.zCoord+xyz[i+2];
- block = rscBase.getWorldObj().getBlock(rscBase.xCoord,rscBase.yCoord,rscBase.zCoord);
- rscBase.getWorldObj().notifyBlockOfNeighborChange(x,y,z,block);
- }
- }
-
- public boolean isIndirectlyConnectedWithContact(Contact contact, int id)
- {
- if(this.get(contact.attachedSlotNumber)!=null)
- {
- if(IHLUtils.isItemStacksIsEqual(this.get(contact.attachedSlotNumber), Ic2Items.splitterCableItem, true))//Redstone sensor
- {
- ForgeDirection dir1 = ForgeDirection.getOrientation(contact.attachedSlotNumber);
- if(this.base.getWorldObj().getIndirectPowerOutput(base.xCoord+dir1.offsetX, base.yCoord+dir1.offsetY, base.zCoord+dir1.offsetZ, dir1.getOpposite().flag))
- {
- Contact oppositeContact = this.getOppositeContact(contact);
- if(oppositeContact.getDataGridID()!=contact.getDataGridID())
- {
- return oppositeContact.isConnectedToContact(id);
- }
- }
- }
- }
- return false;
- }
-
-}
\ No newline at end of file diff --git a/ihl/processing/metallurgy/CrucibleInventory.java b/ihl/processing/metallurgy/CrucibleInventory.java index 57d9c17..cc5707a 100644 --- a/ihl/processing/metallurgy/CrucibleInventory.java +++ b/ihl/processing/metallurgy/CrucibleInventory.java @@ -9,27 +9,26 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
-import net.minecraftforge.oredict.OreDictionary;
import ic2.core.ContainerBase;
import ic2.core.IC2;
import ic2.core.item.tool.HandHeldInventory;
import ic2.core.util.StackUtil;
-public class CrucibleInventory extends HandHeldInventory{
+public class CrucibleInventory extends HandHeldInventory {
ItemStack thisItemStack;
IInventory inventoryContainer;
+
public CrucibleInventory(EntityPlayer player, ItemStack stack) {
super(player, stack, 1);
- thisItemStack=stack;
- inventoryContainer=player.inventory;
+ thisItemStack = stack;
+ inventoryContainer = player.inventory;
}
-
- public CrucibleInventory(IInventory inventoryContainer1, ItemStack stack)
- {
+
+ public CrucibleInventory(IInventory inventoryContainer1, ItemStack stack) {
super(null, stack, 1);
- thisItemStack=stack;
- inventoryContainer=inventoryContainer1;
+ thisItemStack = stack;
+ inventoryContainer = inventoryContainer1;
}
@Override
@@ -55,101 +54,73 @@ public class CrucibleInventory extends HandHeldInventory{ @Override
public boolean isItemValidForSlot(int arg0, ItemStack stack) {
- if(((Crucible)thisItemStack.getItem()).isEmpty(thisItemStack))
- {
- int[] arrayIDs = OreDictionary.getOreIDs(stack);
- for(int i=0; i<arrayIDs.length;i++)
- {
- if(OreDictionary.getOreName(arrayIDs[i]).startsWith("ingot"))
- {
- return true;
- }
- }
- }
- return false;
+ return true;
}
-
+
@Override
- public int getInventoryStackLimit()
- {
- return 6;
- }
+ 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;
- }
- }
- }
-
- }
- }
+ 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/ihl/processing/metallurgy/CrucibleSlot.java b/ihl/processing/metallurgy/CrucibleSlot.java index e0b702d..5fc6a33 100644 --- a/ihl/processing/metallurgy/CrucibleSlot.java +++ b/ihl/processing/metallurgy/CrucibleSlot.java @@ -3,18 +3,16 @@ package ihl.processing.metallurgy; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class CrucibleSlot extends Slot
-{
+public class CrucibleSlot extends Slot {
CrucibleInventory inventory;
- public CrucibleSlot(CrucibleInventory arg0, int arg1, int arg2, int arg3)
- {
+
+ public CrucibleSlot(CrucibleInventory arg0, int arg1, int arg2, int arg3) {
super(arg0, arg1, arg2, arg3);
- inventory=arg0;
+ inventory = arg0;
}
@Override
- public boolean isItemValid(ItemStack itemstack)
- {
- return itemstack == null ? false : inventory.isItemValidForSlot(0, itemstack);
- }
+ public boolean isItemValid(ItemStack itemstack) {
+ return itemstack != null;
+ }
}
diff --git a/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java b/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java index c5a54c7..55db3db 100644 --- a/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java +++ b/ihl/processing/metallurgy/MuffleFurnanceTileEntity.java @@ -1,6 +1,5 @@ package ihl.processing.metallurgy;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -17,15 +16,15 @@ import net.minecraft.item.ItemStack; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-public class MuffleFurnanceTileEntity extends MachineBaseTileEntity{
+public class MuffleFurnanceTileEntity extends MachineBaseTileEntity {
protected static UniversalRecipeManager recipeManager = new UniversalRecipeManager("mufflefurnace");
-
- public MuffleFurnanceTileEntity()
- {
+
+ public MuffleFurnanceTileEntity() {
super(2);
+ this.input.setStackSizeLimit(32);
}
-
+
@Override
public String getStartSoundFile() {
return null;
@@ -56,80 +55,72 @@ public class MuffleFurnanceTileEntity extends MachineBaseTileEntity{ 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 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;
- }
- if(this.getOutput()!=null)
- {
- List<RecipeOutputItemStack> output = MuffleFurnanceTileEntity.recipeManager.getOutputFor(null,this.input.getItemStackList(), true, true).getItemOutputs();
- for(int i=0; i<this.input.size();i++)
- {
- if(i<output.size() && output.get(i)!=null)
- {
+ 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;
+ }
+ if (this.getOutput() != null) {
+ UniversalRecipeOutput routput = recipeManager
+ .getOutputFor(null, this.input.getItemStackList(), true, true);
+ List<RecipeOutputItemStack> output = routput.getItemOutputs();
+ for (int i = 0; i < this.input.size(); i++) {
+ if (i < output.size() && output.get(i) != null) {
ItemStack outStack = output.get(i).itemStack.copy();
- outStack.stackSize=Math.round(output.get(i).quantity);
- if(this.input.get(i)!=null)
- {
- outStack.stackTagCompound=this.input.get(i).stackTagCompound;
+ outStack.stackSize = Math.round(output.get(i).quantity);
+ if (this.input.get(i) != null) {
+ outStack.stackTagCompound = this.input.get(i).stackTagCompound;
}
- this.input.put(i,outStack);
+ this.input.put(i, outStack);
}
- if(this.input.get(i)!=null && this.input.get(i).stackSize<=0)this.input.put(i, null);
+ if (this.input.get(i) != null && this.input.get(i).stackSize <= 0)
+ this.input.put(i, null);
}
}
}
-
- public static void addRecipe(ItemStack input1, ItemStack output)
- {
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack [] {input1})),new UniversalRecipeOutput(null, (new ItemStack [] {output}),20));
+
+ public static void addRecipe(ItemStack input1, ItemStack output) {
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] { input1 })),
+ 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(), false, false);
- }
-
- public static void addRecipe(UniversalRecipeInput universalRecipeInput, UniversalRecipeOutput universalRecipeOutput)
- {
+
+ @Override
+ public UniversalRecipeOutput getOutput() {
+ return MuffleFurnanceTileEntity.recipeManager.getOutputFor(null, this.input.getItemStackList(), false, false);
+ }
+
+ public static void addRecipe(UniversalRecipeInput universalRecipeInput,
+ UniversalRecipeOutput universalRecipeOutput) {
recipeManager.addRecipe(universalRecipeInput, universalRecipeOutput);
}
public static void addRecipe(ItemStack input1, ItemStack output, float f) {
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack [] {input1})),new UniversalRecipeOutput(null, (new RecipeOutputItemStack [] {new RecipeOutputItemStack(output,f)}),20));
+ recipeManager.addRecipe(new UniversalRecipeInput(null, (new ItemStack[] { input1 })), new UniversalRecipeOutput(
+ null, (new RecipeOutputItemStack[] { new RecipeOutputItemStack(output, f) }), 20));
}
}
diff --git a/ihl/processing/metallurgy/PassiveBlock.java b/ihl/processing/metallurgy/PassiveBlock.java deleted file mode 100644 index 74eb0e8..0000000 --- a/ihl/processing/metallurgy/PassiveBlock.java +++ /dev/null @@ -1,99 +0,0 @@ -package ihl.processing.metallurgy;
-
-import ihl.IHLCreativeTab;
-import ihl.IHLModInfo;
-import ihl.items_blocks.IHLItemBlock;
-import ihl.utils.IHLUtils;
-import java.util.List;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.IIcon;
-import net.minecraft.world.IBlockAccess;
-import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-
-public class PassiveBlock extends Block{
-
- @SideOnly(Side.CLIENT)
- private IIcon[][] textures;
-
- private static PassiveBlock instance;
-
- public PassiveBlock()
- {
- super(Material.iron);
- this.setCreativeTab(IHLCreativeTab.tab);
- this.setBlockName("IHLShieldAssemblyUnitBlock");
- this.setHardness(2F);
- this.setResistance(1F);
- instance=this;
- }
-
- public static void init()
- {
- PassiveBlock block = new PassiveBlock();
- GameRegistry.registerBlock(block, IHLItemBlock.class, "IHLShieldAssemblyUnitBlock");
- Type[] var1 = Type.values();
- for(int i=0;i<var1.length;i++)
- {
- IHLItemBlock blockItem = (IHLItemBlock) Item.getItemFromBlock(block);
- blockItem.nameMap.put(var1[i].meta,var1[i].unlocalizedName);
- IHLUtils.registerLocally(var1[i].unlocalizedName, new ItemStack(block,1,var1[i].meta));
- }
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item item, CreativeTabs tabs, List itemList)
- {
- Type[] var1 = Type.values();
- for(int i=0;i<var1.length;i++)
- {
- ItemStack stack = IHLUtils.getThisModItemStack(var1[i].unlocalizedName);
- itemList.add(stack);
- }
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister par1IconRegister)
- {
- textures = new IIcon[2][6];
- textures[0][3]=textures[0][4]=textures[0][2]=textures[0][5]=this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":shieldAU");
- textures[1][0]=textures[1][1]=textures[0][0]=textures[0][1]=par1IconRegister.registerIcon(IHLModInfo.MODID + ":shieldAUTop");
- textures[1][3]=textures[1][4]=textures[1][2]=textures[1][5]=this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":shieldAU2");
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
- {
- int meta = world.getBlockMetadata(x, y, z);
- return textures[meta][side];
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(int side, int meta)
- {
- return textures[meta][side];
- }
-
- public enum Type
- {
- AdvancedShieldAssemblyUnitBlock("advancedShieldAssemblyUnitBlock", 1),
- IHLShieldAssemblyUnitBlock("IHLShieldAssemblyUnitBlock", 0);
- Type(String unlocalizedName1, int meta1)
- {
- unlocalizedName=unlocalizedName1;
- meta=meta1;
- }
- public String unlocalizedName;
- public int meta;
- }
-}
\ No newline at end of file diff --git a/ihl/processing/metallurgy/VacuumInductionMeltingFurnaceContainer.java b/ihl/processing/metallurgy/VacuumInductionMeltingFurnaceContainer.java deleted file mode 100644 index 75c69e8..0000000 --- a/ihl/processing/metallurgy/VacuumInductionMeltingFurnaceContainer.java +++ /dev/null @@ -1,77 +0,0 @@ -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.minecraftforge.fluids.FluidStack;
-
-public class VacuumInductionMeltingFurnaceContainer extends ContainerBase {
- public int lastFluidAmount = -1;
- public int lastNumberOfFluids = -1;
- public short lastProgress = -1;
- public short lastEnergy = -1;
- public VacuumInductionMeltingFurnaceTileEntity tileEntity;
- private final static int height=166;
- public List<FluidStack> fluidTankFluidList;
- private boolean vacuumPumpState=true;
-
- public VacuumInductionMeltingFurnaceContainer(EntityPlayer entityPlayer, VacuumInductionMeltingFurnaceTileEntity tileEntity1) {
- super(tileEntity1);
- this.tileEntity=tileEntity1;
- fluidTankFluidList = this.tileEntity.fluidTank.getFluidList();
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.input, 0, 141, 8));
- }
- @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.fluidTank.getFluidAmount() != this.lastFluidAmount || this.tileEntity.fluidTank.getNumberOfFluids() != this.lastNumberOfFluids)
- {
- IC2.network.get().sendContainerField(this, "fluidTankFluidList");
- }
-
- if (this.tileEntity.progress != this.lastProgress)
- {
- icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.progress);
- }
-
- if (this.tileEntity.vacuumPumpConnected != this.vacuumPumpState)
- {
- icrafting.sendProgressBarUpdate(this, 1, this.tileEntity.vacuumPumpConnected?1:0);
- }
- }
-
- this.lastNumberOfFluids = this.tileEntity.fluidTank.getNumberOfFluids();
- this.lastFluidAmount = this.tileEntity.fluidTank.getFluidAmount();
- this.lastProgress = this.tileEntity.progress;
- this.vacuumPumpState = this.tileEntity.vacuumPumpConnected;
- }
-
- @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.vacuumPumpConnected=value>0;
- break;
- }
- }
-
- @Override
- public boolean canInteractWith(EntityPlayer var1) {
- return tileEntity.isUseableByPlayer(var1);
- }
-}
diff --git a/ihl/processing/metallurgy/VacuumInductionMeltingFurnaceGui.java b/ihl/processing/metallurgy/VacuumInductionMeltingFurnaceGui.java deleted file mode 100644 index 2f22a4d..0000000 --- a/ihl/processing/metallurgy/VacuumInductionMeltingFurnaceGui.java +++ /dev/null @@ -1,85 +0,0 @@ -package ihl.processing.metallurgy;
-
-import ic2.core.IC2;
-import ihl.collector.GuiMultiTextureButton;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.client.gui.inventory.GuiContainer;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.StatCollector;
-import org.lwjgl.opengl.GL11;
-
-public class VacuumInductionMeltingFurnaceGui extends GuiContainer {
- protected static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIVacuumInductionMeltingFurnace.png");
- private VacuumInductionMeltingFurnaceContainer container;
- private GuiMultiTextureButton button1;
- private int timer=10;
-
-
- public VacuumInductionMeltingFurnaceGui(VacuumInductionMeltingFurnaceContainer vacuumInductionMeltingFurnaceContainer) {
- //the container is instanciated and passed to the superclass for handling
- super(vacuumInductionMeltingFurnaceContainer);
- this.container=vacuumInductionMeltingFurnaceContainer;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void initGui()
- {
- super.initGui();
- int x = (width - xSize) / 2;
- int y = (height - ySize) / 2;
- button1=new GuiMultiTextureButton(0, x+13, y+55, 27, 27, background,13,55,229,229);
- 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=false;
- timer=10;
- }
- }
-
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2) {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- fontRendererObj.drawString(StatCollector.translateToLocal("ihl.gui.muffleFurnace"), 40, 12, 14722081);
- this.mc.renderEngine.bindTexture(background);
- 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(50),50);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- 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(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=true;
- }
- }
-}
diff --git a/ihl/processing/metallurgy/VacuumInductionMeltingFurnaceTileEntity.java b/ihl/processing/metallurgy/VacuumInductionMeltingFurnaceTileEntity.java deleted file mode 100644 index e2867bc..0000000 --- a/ihl/processing/metallurgy/VacuumInductionMeltingFurnaceTileEntity.java +++ /dev/null @@ -1,200 +0,0 @@ -package ihl.processing.metallurgy;
-
-import java.util.Arrays;
-import java.util.Map;
-
-import ic2.api.network.INetworkClientTileEntityEventListener;
-import ic2.api.recipe.IRecipeInput;
-import ic2.api.recipe.RecipeInputOreDict;
-import ic2.core.ContainerBase;
-import ihl.processing.chemistry.GaedesMercuryRotaryPumpTileEntity;
-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.FluidStack;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-
-public class VacuumInductionMeltingFurnaceTileEntity extends MachineBaseTileEntity implements INetworkClientTileEntityEventListener{
-
- protected static UniversalRecipeManager recipeManager = new UniversalRecipeManager("vacuuminductionmeltingfurnace");
- public final IHLFluidTank fluidTank = new IHLFluidTank(864);
- public boolean vacuumPumpConnected=false;
- private GaedesMercuryRotaryPumpTileEntity lastGMRP;
-
- public VacuumInductionMeltingFurnaceTileEntity()
- {
- super(1);
- }
-
- @Override
- public void setFacing(short facing1)
- {
- short facing2 = (short) Math.max(facing1, 2);
- super.setFacing(facing2);
- }
-
- @Override
- public String getStartSoundFile() {
- return null;
- }
-
- @Override
- public String getLoopSoundFile() {
- return null;
- }
-
- @Override
- public String getStopSoundFile() {
- return null;
- }
-
- @Override
- public String getInventoryName() {
- return "VacuumInductionMeltingFurnace";
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public GuiScreen getGui(EntityPlayer player, boolean arg1) {
- return new VacuumInductionMeltingFurnaceGui(new VacuumInductionMeltingFurnaceContainer(player, this));
- }
-
- @Override
- public ContainerBase<?> getGuiContainer(EntityPlayer player) {
- return new VacuumInductionMeltingFurnaceContainer(player, this);
- }
-
- @Override
- public void operate()
- {
- ItemStack content = this.input.get();
- if(content!=null)
- {
- UniversalRecipeOutput routput = recipeManager.getOutputFor(null, Arrays.asList(new ItemStack [] {content}),false, false);
- if(routput!=null && !routput.getFluidOutputs().isEmpty())
- {
- FluidStack fluidStack = routput.getFluidOutputs().get(0).copy();
- fluidStack.amount *= content.stackSize;
- this.input.clear();
- this.fluidTank.fill(fluidStack, true);
- useVacuumPump();
- }
- }
- }
-
- @Override
- public boolean canOperate()
- {
- return checkSpecialConditionVacuumPump() && getOutput()!=null;
- }
-
- private void useVacuumPump()
- {
- if(lastGMRP!=null && !lastGMRP.isInvalid() && lastGMRP.ready)
- {
- lastGMRP.ready=false;
- }
- }
-
- private boolean checkSpecialConditionVacuumPump()
- {
- if(lastGMRP!=null && !lastGMRP.isInvalid() && lastGMRP.ready)
- {
- this.vacuumPumpConnected=true;
- return true;
- }
- int[] xz = new int [] {0,1,1,0,-1,-1,0};
- for(int i0=-1;i0<=0;i0++)
- {
- for(int i=0;i<xz.length-1;i++)
- {
- TileEntity te = worldObj.getTileEntity(xCoord+xz[i], yCoord+i0, zCoord+xz[i+1]);
- if(te instanceof GaedesMercuryRotaryPumpTileEntity)
- {
- GaedesMercuryRotaryPumpTileEntity gmrp = (GaedesMercuryRotaryPumpTileEntity)te;
- lastGMRP = gmrp;
- this.vacuumPumpConnected=gmrp.ready;
- return gmrp.ready;
- }
- }
- }
- this.vacuumPumpConnected=false;
- return false;
- }
-
- @Override
- public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
- return IHLUtils.getThisModItemStack("vacuumInductionMeltingFurnace");
- }
-
- public static void addRecipe(String input, int amount, String input2, int amount2, FluidStack output)
- {
- recipeManager.addRecipe(new UniversalRecipeInput(null, (new IRecipeInput [] {new RecipeInputOreDict(input,amount),new RecipeInputOreDict(input2,amount2)})),new UniversalRecipeOutput((new FluidStack[] {output}),null,20));
- }
-
-
- public static Map<UniversalRecipeInput, UniversalRecipeOutput> getRecipes() {
- return recipeManager.getRecipes();
- }
-
- @Override
- public UniversalRecipeOutput getOutput()
- {
- return VacuumInductionMeltingFurnaceTileEntity.recipeManager.getOutputFor(this.getInput(), false, false);
- }
-
- @Override
- public void onNetworkEvent(EntityPlayer player, int event)
- {
- switch(event)
- {
- case 0:
- TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord);
- if(te instanceof InjectionMoldTileEntity)
- {
- InjectionMoldTileEntity im = (InjectionMoldTileEntity)te;
- im.fill(ForgeDirection.UP, this.fluidTank.drain(this.fluidTank.getCapacity(), true), true);
- }
- break;
- }
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbttagcompound)
- {
- super.readFromNBT(nbttagcompound);
- try
- {
- this.energy = nbttagcompound.getDouble("energy");
- }
- catch (Exception var3)//This was blindlessly copied from IC2 source a lot of time ago. And this is not necessary here. And still...
- {
- this.energy = nbttagcompound.getInteger("energy");
-
- if (this.maxStorage > Integer.MAX_VALUE)
- {
- this.energy *= 10.0D;
- }
- }
- this.fluidTank.readFromNBT(nbttagcompound.getCompoundTag("fluidTank"));
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbttagcompound)
- {
- super.writeToNBT(nbttagcompound);
- nbttagcompound.setDouble("energy", this.energy);
- NBTTagCompound fluidTankTag = new NBTTagCompound();
- this.fluidTank.writeToNBT(fluidTankTag);
- nbttagcompound.setTag("fluidTank", fluidTankTag);
- }
-}
|
