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/metallurgy/CrucibleInventory.java | |
| 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/metallurgy/CrucibleInventory.java')
| -rw-r--r-- | ihl/processing/metallurgy/CrucibleInventory.java | 173 |
1 files changed, 72 insertions, 101 deletions
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;
+ }
+ }
+ }
+
+ }
+ }
}
|
