aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java2
-rw-r--r--src/Java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java2
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java137
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java3
-rw-r--r--src/Java/gtPlusPlus/core/recipe/common/CI.java5
-rw-r--r--src/Java/gtPlusPlus/core/util/Utils.java25
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/EnergyUtils.java15
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java12
8 files changed, 104 insertions, 97 deletions
diff --git a/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java b/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java
index efd6f88885..15d330defc 100644
--- a/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java
+++ b/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java
@@ -52,6 +52,8 @@ public class DecayablesChest extends BlockContainer implements ITileTooltip
super(Material.iron);
this.setBlockName("blockDecayablesChest");
this.setCreativeTab(AddToCreativeTab.tabMachines);
+ this.setHardness(5f);
+ this.setResistance(1f);
GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockDecayablesChest");
LanguageRegistry.addName(this, "Lead Lined Box");
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
diff --git a/src/Java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java b/src/Java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java
index e6129317c6..8e0b1b48ce 100644
--- a/src/Java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java
+++ b/src/Java/gtPlusPlus/core/entity/item/ItemEntityGiantEgg.java
@@ -86,6 +86,7 @@ public class ItemEntityGiantEgg extends EntityItem {
ItemStack g = this.getEntityItem();
NBTUtils.setInteger(g, "mTicksExisted", this.age);
NBTUtils.setInteger(g, "lifespan", this.lifespan);
+ NBTUtils.setBoolean(g, "playerHeld", false);
this.setEntityItemStack(g);
Logger.INFO("Writing age to NBT of stored stack item.");
}
@@ -93,6 +94,7 @@ public class ItemEntityGiantEgg extends EntityItem {
ItemStack g = ItemUtils.getSimpleStack(ModItems.itemBigEgg);
NBTUtils.setInteger(g, "mTicksExisted", this.age);
NBTUtils.setInteger(g, "lifespan", this.lifespan);
+ NBTUtils.setBoolean(g, "playerHeld", false);
this.setEntityItemStack(g);
Logger.INFO("Writing age to NBT of new stack item.");
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java
index 4616ab0aa0..0c31b999cd 100644
--- a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java
+++ b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java
@@ -797,7 +797,7 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
}
// Handle no stored fluid first
if (aStoredFluid == null) {
- Logger.WARNING("Pump is empty, filling with tank fluids.");
+ Logger.INFO("Pump is empty, filling with tank fluids.");
FluidStack toConsume;
int amountToConsume = 0;
if (resource.amount >= aCapacity) {
@@ -811,32 +811,32 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
return amountToConsume;
}
} else {
- Logger.WARNING("Pump is Partially full, filling with tank fluids.");
+ Logger.INFO("Pump is Partially full, filling with tank fluids.");
if (aStoredFluid.isFluidEqual(resource)) {
- Logger.WARNING("Found matching fluids.");
+ Logger.INFO("Found matching fluids.");
int aSpaceLeft = (aCapacity - aStoredAmount);
- Logger.WARNING(
+ Logger.INFO(
"Capacity: " + aCapacity + " | Stored: " + aStoredAmount + " | Space left: " + aSpaceLeft);
FluidStack toConsume;
int amountToConsume = 0;
if (resource.amount >= aSpaceLeft) {
amountToConsume = aSpaceLeft;
- Logger.WARNING("More or equal fluid amount to pump container space.");
+ Logger.INFO("More or equal fluid amount to pump container space.");
} else {
amountToConsume = resource.amount;
- Logger.WARNING("Less fluid than container space");
+ Logger.INFO("Less fluid than container space");
}
- Logger.WARNING("Amount to consume: " + amountToConsume);
+ Logger.INFO("Amount to consume: " + amountToConsume);
toConsume = FluidUtils.getFluidStack(resource, (aStoredAmount + amountToConsume));
if (toConsume != null && amountToConsume > 0) {
- Logger.WARNING("Storing Fluid");
+ Logger.INFO("Storing Fluid");
storeFluid(container, toConsume);
return amountToConsume;
} else {
- Logger.WARNING("Not storing fluid");
+ Logger.INFO("Not storing fluid");
}
} else {
- Logger.WARNING("Fluids did not match.");
+ Logger.INFO("Fluids did not match.");
}
}
}
@@ -943,7 +943,7 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
}
if (!canUse(aStack, removal) && aTier > 0) {
PlayerUtils.messagePlayer(aPlayer, "Not enough power.");
- Logger.WARNING("No Power");
+ Logger.INFO("No Power");
return false;
}
@@ -990,12 +990,12 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
public boolean drainIFluidTank(TileEntity tTileEntity, ItemStack aStack, World aWorld, EntityPlayer aPlayer, int aX,
int aY, int aZ) {
if (tTileEntity == null) {
- Logger.WARNING("Invalid Tile, somehow.");
+ Logger.INFO("Invalid Tile, somehow.");
return false;
}
if ((tTileEntity instanceof IFluidTank || tTileEntity instanceof IFluidHandler)) {
if (this.getFluid(aStack) == null || (this.getFluid(aStack) != null && this.getFluid(aStack).amount < this.getCapacity(aStack))) {
- Logger.WARNING("Trying to find Stored Fluid - Behaviour Class.");
+ Logger.INFO("Trying to find Stored Fluid - Behaviour Class.");
FluidStack aStored = getStoredFluidOfVanillaTank(tTileEntity);
if (aStored != null) {
int mAmountInserted = fill(aStack, aStored);
@@ -1007,22 +1007,22 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
newStackRemainingInTank = FluidUtils.getFluidStack(aStored, (aStored.amount - mAmountInserted));
}
boolean b = setStoredFluidOfVanillaTank(tTileEntity, newStackRemainingInTank);
- Logger.WARNING("Cleared Tank? " + b + " | mAmountInserted: " + mAmountInserted);
- Logger.WARNING("Returning " + b + " - drainTankVanilla.");
+ Logger.INFO("Cleared Tank? " + b + " | mAmountInserted: " + mAmountInserted);
+ Logger.INFO("Returning " + b + " - drainTankVanilla.");
if (b) {
PlayerUtils.messagePlayer(aPlayer, "Drained "+mAmountInserted+"L of "+aStored.getLocalizedName()+".");
}
return b;
}
} else {
- Logger.WARNING("Found no valid Fluidstack - drainTankVanilla.");
+ Logger.INFO("Found no valid Fluidstack - drainTankVanilla.");
}
}
else {
- Logger.WARNING("Pump is full.");
+ Logger.INFO("Pump is full.");
}
}
- Logger.WARNING("Could not drain vanilla tank.");
+ Logger.INFO("Could not drain vanilla tank.");
return false;
}
@@ -1036,16 +1036,16 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
return false;
}
if ((tTileEntity instanceof IGregTechTileEntity)) {
- Logger.WARNING("Right Clicking on GT Tile - drainTankGT.");
+ Logger.INFO("Right Clicking on GT Tile - drainTankGT.");
if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) {
- Logger.WARNING("Returning False - Behaviour Class. Timer < 50");
+ Logger.INFO("Returning False - Behaviour Class. Timer < 50");
return false;
} else if ((!aWorld.isRemote) && (!((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer))) {
- Logger.WARNING("Returning True - drainTankGT. NotUsable()");
+ Logger.INFO("Returning True - drainTankGT. NotUsable()");
return true;
} else {
if (this.getFluid(aStack) == null || (this.getFluid(aStack) != null && this.getFluid(aStack).amount < this.getCapacity(aStack))) {
- Logger.WARNING("Trying to find Stored Fluid - drainTankGT.");
+ Logger.INFO("Trying to find Stored Fluid - drainTankGT.");
FluidStack aStored = getStoredFluidOfGTMachine((IGregTechTileEntity) tTileEntity);
if (aStored != null) {
int mAmountInserted = fill(aStack, aStored);
@@ -1057,23 +1057,23 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
newStackRemainingInTank = FluidUtils.getFluidStack(aStored, (aStored.amount - mAmountInserted));
}
boolean b = setStoredFluidOfGTMachine((IGregTechTileEntity) tTileEntity, newStackRemainingInTank);
- Logger.WARNING("Cleared Tank? " + b + " | mAmountInserted: " + mAmountInserted);
- Logger.WARNING("Returning " + b + " - drainTankGT.");
+ Logger.INFO("Cleared Tank? " + b + " | mAmountInserted: " + mAmountInserted);
+ Logger.INFO("Returning " + b + " - drainTankGT.");
if (b) {
PlayerUtils.messagePlayer(aPlayer, "Drained "+mAmountInserted+"L of "+aStored.getLocalizedName()+".");
}
return b;
}
} else {
- Logger.WARNING("Found no valid Fluidstack - drainTankGT.");
+ Logger.INFO("Found no valid Fluidstack - drainTankGT.");
}
}
else {
- Logger.WARNING("Pump is full.");
+ Logger.INFO("Pump is full.");
}
}
}
- Logger.WARNING("Could not drain GT tank.");
+ Logger.INFO("Could not drain GT tank.");
return false;
}
@@ -1097,7 +1097,7 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
public FluidStack getStoredFluidOfVanillaTank(IFluidTank aTileEntity) {
FluidStack f = aTileEntity.getFluid();
- Logger.WARNING("Returning Fluid stack from tile. Found: "
+ Logger.INFO("Returning Fluid stack from tile. Found: "
+ (f != null ? f.getLocalizedName() + " - " + f.amount + "L" : "Nothing"));
return f;
}
@@ -1119,14 +1119,14 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
}
public boolean setStoredFluidOfVanillaTank(TileEntity aTileEntity, FluidStack aSetFluid) {
- Logger.WARNING("Trying to clear Tile's tank. - Behaviour Class. [1]");
+ Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [1]");
if (aTileEntity == null) {
return false;
}
else if ((aTileEntity instanceof IFluidTank || aTileEntity instanceof IFluidHandler)) {
if (aTileEntity instanceof IFluidTank) {
- Logger.WARNING("Tile Was instanceof IFluidTank.");
+ Logger.INFO("Tile Was instanceof IFluidTank.");
FluidStack f = ((IFluidTank) aTileEntity).getFluid();
if (aSetFluid == null) {
aSetFluid = f;
@@ -1141,10 +1141,10 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
}
if (newStack.isFluidEqual(aSetFluid) && newStack.amount == aSetFluid.amount) {
- Logger.WARNING("Removed fluid from vanilla IFluidTank successfully.");
+ Logger.INFO("Removed fluid from vanilla IFluidTank successfully.");
return true;
} else {
- Logger.WARNING("Failed trying to remove fluid from vanilla IFluidTank.");
+ Logger.INFO("Failed trying to remove fluid from vanilla IFluidTank.");
return false;
}
}
@@ -1152,7 +1152,7 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
//Rewrite Fluid handling for Vanilla type tanks
if (!IFluidHandler.class.isInstance(aTileEntity)) {
- Logger.WARNING("Tile Was not an instance of IFluidHandler.");
+ Logger.INFO("Tile Was not an instance of IFluidHandler.");
return false;
}
@@ -1163,37 +1163,37 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
if (a1 != null) {
if (a1[0] != null) {
aTankContents = a1[0].fluid;
- Logger.WARNING("Found Fluid in Tank. "+aTankContents.getLocalizedName()+" - "+aTankContents.amount);
+ Logger.INFO("Found Fluid in Tank. "+aTankContents.getLocalizedName()+" - "+aTankContents.amount);
}
}
if (aSetFluid == null) {
- Logger.WARNING("Setting fluid to tank contents, as we're going to empty it totally.");
+ Logger.INFO("Setting fluid to tank contents, as we're going to empty it totally.");
aSetFluid = aTankContents.copy();
}
else {
- Logger.WARNING("Setting fluid to tank contents, as we're going to empty it totally.");
+ Logger.INFO("Setting fluid to tank contents, as we're going to empty it totally.");
}
- Logger.WARNING("Tile Was instance of IFluidHandler. Trying to Drain "+aSetFluid.getLocalizedName()+" - "+aSetFluid.amount);
+ Logger.INFO("Tile Was instance of IFluidHandler. Trying to Drain "+aSetFluid.getLocalizedName()+" - "+aSetFluid.amount);
if (a1 == null || aTankContents == null) {
- Logger.WARNING("Tank is empty.");
+ Logger.INFO("Tank is empty.");
return false;
}
//Found some Fluid in the tank
else {
FluidStack aDrainedStack = aTank.drain(ForgeDirection.UNKNOWN, aSetFluid, true);
if (aDrainedStack.isFluidStackIdentical(aSetFluid)) {
- Logger.WARNING("Drained!");
+ Logger.INFO("Drained!");
return true;
}
else {
- Logger.WARNING("Partially Drained! This is probably an error.");
+ Logger.INFO("Partially Drained! This is probably an error.");
return true;
}
}
}
} else {
- Logger.WARNING("Bad Tank Tile to drain.");
+ Logger.INFO("Bad Tank Tile to drain.");
return false;
}
@@ -1213,7 +1213,7 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
return null;
}
if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicTank) {
- Logger.WARNING("Tile Was Instanceof BasicTank.");
+ Logger.INFO("Tile Was Instanceof BasicTank.");
return getStoredFluidOfGTMachine((GT_MetaTileEntity_BasicTank) aMetaTileEntity);
} else {
return null;
@@ -1224,38 +1224,27 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
FluidStack f = aTileEntity.mFluid;
//Let's see if this machine has output fluid too
- if (f == null) {
- Logger.WARNING("Could not find any input fluid, checking output if possible.");
- if (aTileEntity instanceof GT_MetaTileEntity_BasicMachine) {
- GT_MetaTileEntity_BasicMachine g = (GT_MetaTileEntity_BasicMachine) aTileEntity;
- Logger.WARNING("Tile is a Basic Machine of some sort - "+g.mNEIName);
- if (g != null) {
- f = g.mOutputFluid;
- if (f != null) {
- Logger.WARNING("Found output fluid! "+f.getLocalizedName());
- }
- else {
- Logger.WARNING("Did not find anything!");
- f = g.getFluid();
- if (f != null) {
- Logger.WARNING("Found fluid! "+f.getLocalizedName());
- }
- else {
- Logger.WARNING("Did not find anything!");
- f = g.getFluid();
- }
- }
- }
- }
- }
+ /*
+ * if (f == null) {
+ * Logger.INFO("Could not find any input fluid, checking output if possible.");
+ * if (aTileEntity instanceof GT_MetaTileEntity_BasicMachine) {
+ * GT_MetaTileEntity_BasicMachine g = (GT_MetaTileEntity_BasicMachine)
+ * aTileEntity;
+ * Logger.INFO("Tile is a Basic Machine of some sort - "+g.mNEIName); if (g !=
+ * null) { f = g.mOutputFluid; if (f != null) {
+ * Logger.INFO("Found output fluid! "+f.getLocalizedName()); } else {
+ * Logger.INFO("Did not find anything!"); f = g.getFluid(); if (f != null) {
+ * Logger.INFO("Found fluid! "+f.getLocalizedName()); } else {
+ * Logger.INFO("Did not find anything!"); f = g.getFluid(); } } } } }
+ */
- Logger.WARNING("Returning Fluid stack from tile. Found: "
+ Logger.INFO("Returning Fluid stack from tile. Found: "
+ (f != null ? f.getLocalizedName() + " - " + f.amount + "L" : "Nothing"));
return f;
}
public boolean setStoredFluidOfGTMachine(IGregTechTileEntity aTileEntity, FluidStack aSetFluid) {
- Logger.WARNING("Trying to clear Tile's tank. - Behaviour Class. [1]");
+ Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [1]");
if (aTileEntity == null) {
return false;
}
@@ -1264,7 +1253,7 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
return false;
}
if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicTank) {
- Logger.WARNING("Trying to clear Tile's tank. - Behaviour Class. [2]");
+ Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [2]");
return setStoredFluidOfGTMachine((GT_MetaTileEntity_BasicTank) aMetaTileEntity, aSetFluid);
} else {
return false;
@@ -1275,16 +1264,16 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri
try {
//Try Handle Outputs First
- if (aTileEntity.setDrainableStack(aSetFluid) != null) {
- return true;
- }
+ /*
+ * if (aTileEntity.setDrainableStack(aSetFluid) != null) { return true; }
+ */
aTileEntity.mFluid = aSetFluid;
boolean b = aTileEntity.mFluid == aSetFluid;
- Logger.WARNING("Trying to set Tile's tank. - Behaviour Class. [3] " + b);
+ Logger.INFO("Trying to set Tile's tank. - Behaviour Class. [3] " + b);
return b;
} catch (Throwable t) {
- Logger.WARNING("Trying to clear Tile's tank. FAILED - Behaviour Class. [x]");
+ Logger.INFO("Trying to clear Tile's tank. FAILED - Behaviour Class. [x]");
return false;
}
}
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
index e9c1da024c..bfd50e0ce1 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
@@ -931,6 +931,7 @@ public class RECIPES_Machines {
}
if (CORE.ConfigSwitches.enableMachine_Pollution && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){
+
RecipeUtils.addShapedGregtechRecipe(
"plateCarbon", "plateCarbon", "plateCarbon",
"dustCarbon", "dustCarbon", "dustCarbon",
@@ -961,7 +962,7 @@ public class RECIPES_Machines {
RecipeUtils.addShapedGregtechRecipe(
CI.component_Plate[6], ItemList.Casing_Grate.get(1), CI.component_Plate[6],
CI.component_Plate[6], aTieredFluidRegulator, CI.component_Plate[6],
- CI.getTieredCircuit(5), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(5),
+ CI.getTieredCircuit(4), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(4),
GregtechItemList.Hatch_Air_Intake.get(1));
//ULV
diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java
index ca334fe0d3..dffb438e4a 100644
--- a/src/Java/gtPlusPlus/core/recipe/common/CI.java
+++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java
@@ -484,10 +484,13 @@ public class CI {
public static void init() {
//Set Explosives
try {
- ItemList PowerderBarrel = gtPlusPlus.core.util.Utils.getValueOfItemList("Block_Powderbarrel", null);
+ ItemList PowerderBarrel = Utils.getValueOfItemList("Block_Powderbarrel", null);
if (PowerderBarrel != null){
explosivePowderKeg = PowerderBarrel.get(1).copy();
}
+ else {
+ explosivePowderKeg = ItemUtils.getSimpleStack(Items.gunpowder).copy();
+ }
} catch (java.lang.IllegalArgumentException Y) {
explosivePowderKeg = ItemUtils.getSimpleStack(Items.gunpowder).copy();
}
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java
index 3b3ba88e88..bb1d9064e8 100644
--- a/src/Java/gtPlusPlus/core/util/Utils.java
+++ b/src/Java/gtPlusPlus/core/util/Utils.java
@@ -928,24 +928,19 @@ public class Utils {
return false;
}
- public static ItemList getValueOfItemList(String string, ItemList aOther) {
- try {
- Method method = ItemList.class.getDeclaredMethod("values");
- Object obj = method.invoke(null);
- String y = Arrays.toString((Object[]) obj);
- String[] aCurrentItemsInList = y.split(",");
- boolean found = false;
- for (String g : aCurrentItemsInList) {
- if (g.equals(string)) {
- found = true;
- break;
+ public static ItemList getValueOfItemList(String string, ItemList aOther) {
+ ItemList[] aListValues = ItemList.class.getEnumConstants();
+ for (ItemList aItem : aListValues) {
+ if (aItem != null) {
+ if (aItem.name().equals(string) || aItem.name().toLowerCase().equals(string.toLowerCase())) {
+ return aItem;
}
}
- if (found) {
- return ItemList.valueOf(string);
- }
}
- catch (Throwable t) {}
+ Logger.INFO("Tried to obtain '"+string+"' from the GT ItemList, however it does not exist.");
+ if (aOther != null) {
+ Logger.INFO("Using fallback option instead - "+aOther.name());
+ }
return aOther;
}
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/EnergyUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/EnergyUtils.java
index 51bedaf64b..ef68436f21 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/EnergyUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/EnergyUtils.java
@@ -1,6 +1,9 @@
package gtPlusPlus.core.util.minecraft;
+import gregtech.api.enums.GT_Values;
import gregtech.api.util.GT_ModHandler;
+import gtPlusPlus.api.objects.Logger;
+import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
@@ -33,8 +36,16 @@ public class EnergyUtils {
return 0 != GT_ModHandler.chargeElectricItem(aStack, aEnergyToInsert, aTier, true, false);
}
- public static boolean discharge(ItemStack aStack, int aEnergyToInsert, int aTier) {
- return 0 != GT_ModHandler.dischargeElectricItem(aStack, -aEnergyToInsert, aTier, true, false, true);
+ public static boolean discharge(ItemStack aStack, int aEnergyToDrain, int aTier) {
+ if (isElectricItem(aStack)) {
+ int tTier = ((IElectricItem) aStack.getItem()).getTier(aStack);
+ int aDischargeValue = GT_ModHandler.dischargeElectricItem(aStack, aEnergyToDrain, tTier, true, false, false);
+ Logger.INFO("Trying to drain "+aDischargeValue);
+ return aDischargeValue > 0;
+ }
+ else {
+ return false;
+ }
}
public static long getMaxStorage(ItemStack aStack) {
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java
index 8f12d20494..aaa81a0057 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java
@@ -17,10 +17,14 @@ public class InventoryUtils {
public static void dropInventoryItems(World world, int x, int y, int z, Block block) {
TileEntity tileentity = world.getTileEntity(x, y, z);
- if (tileentity != null && tileentity instanceof IInventory
- && ((IInventory) tileentity).getSizeInventory() > 0) {
- for (int i1 = 0; i1 < ((IInventory) tileentity).getSizeInventory(); ++i1) {
- ItemStack itemstack = ((IInventory) tileentity).getStackInSlot(i1);
+ if (tileentity != null && tileentity instanceof IInventory && ((IInventory) tileentity).getSizeInventory() > 0) {
+
+ IInventory aTileInv = (IInventory) tileentity;
+ int aMinSlot = 0;
+ int aMaxSlot = aTileInv.getSizeInventory()-1;
+
+ for (int i1 = aMinSlot; i1 < aMaxSlot; ++i1) {
+ ItemStack itemstack = aTileInv.getStackInSlot(i1);
if (itemstack != null) {
float f = mRandom.nextFloat() * 0.8F + 0.1F;