aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java')
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java74
1 files changed, 40 insertions, 34 deletions
diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java
index c4efbb4995..461fa6ff04 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java
@@ -10,83 +10,89 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class SlotGtToolElectric extends SlotGtTool {
- public int tier;
- private ItemStack content;
+ public int tier;
+ private ItemStack content;
- public boolean allowRedstoneDust = true;
-
- public SlotGtToolElectric(final IInventory base, final int x, final int y, final int z, final int tier,
- final boolean allowRedstoneDust) {
+ public SlotGtToolElectric(IInventory base, int x, int y, int z, int tier, boolean allowRedstoneDust)
+ {
super(base, x, y, z);
this.tier = tier;
this.allowRedstoneDust = allowRedstoneDust;
}
- public boolean accepts(final ItemStack stack) {
+ public boolean accepts(ItemStack stack)
+ {
if (stack == null) {
return false;
}
- if (stack.getItem() == Items.redstone && !this.allowRedstoneDust) {
+ if ((stack.getItem() == Items.redstone) && (!this.allowRedstoneDust)) {
return false;
}
- return Info.itemEnergy.getEnergyValue(stack) > 0.0D
- || ElectricItem.manager.discharge(stack, 1.0D / 0.0D, this.tier, true, true, true) > 0.0D;
+ return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), this.tier, true, true, true) > 0.0D);
}
- public double discharge(final double amount, final boolean ignoreLimit) {
+ public double discharge(double amount, boolean ignoreLimit)
+ {
if (amount <= 0.0D) {
throw new IllegalArgumentException("Amount must be > 0.");
}
- final ItemStack stack = this.get(0);
+ ItemStack stack = get(0);
if (stack == null) {
return 0.0D;
}
double realAmount = ElectricItem.manager.discharge(stack, amount, this.tier, ignoreLimit, true, false);
- if (realAmount <= 0.0D) {
+ if (realAmount <= 0.0D)
+ {
realAmount = Info.itemEnergy.getEnergyValue(stack);
if (realAmount <= 0.0D) {
return 0.0D;
}
stack.stackSize -= 1;
if (stack.stackSize <= 0) {
- this.put(0, null);
+ put(0, null);
}
}
return realAmount;
}
- public ItemStack get() {
- return this.get(0);
+ public void setTier(int tier1)
+ {
+ this.tier = tier1;
}
- public ItemStack get(final int index) {
- return this.content;
+ public boolean allowRedstoneDust = true;
+
+ public ItemStack get()
+ {
+ return get(0);
}
- @Override
- public boolean isItemValid(final ItemStack itemstack) {
- if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem) {
- Utils.LOG_WARNING(itemstack.getDisplayName() + " is a valid Tool.");
- return true;
- }
- Utils.LOG_WARNING(itemstack.getDisplayName() + " is not a valid Tool.");
- return false;
+ public ItemStack get(int index)
+ {
+ return this.content;
}
- public void onChanged() {
+ public void put(ItemStack content)
+ {
+ put(0, content);
}
- public void put(final int index, final ItemStack content) {
+ public void put(int index, ItemStack content)
+ {
this.content = content;
- this.onChanged();
+ onChanged();
}
- public void put(final ItemStack content) {
- this.put(0, content);
- }
+ public void onChanged() {}
- public void setTier(final int tier1) {
- this.tier = tier1;
+ @Override
+ public boolean isItemValid(ItemStack itemstack) {
+ if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem){
+ Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Tool.");
+ return true;
+ }
+ Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool.");
+ return false;
}
}