aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kubatech/api/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kubatech/api/helpers')
-rw-r--r--src/main/java/kubatech/api/helpers/GTHelper.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/main/java/kubatech/api/helpers/GTHelper.java b/src/main/java/kubatech/api/helpers/GTHelper.java
index fe6a2a6167..645cd49356 100644
--- a/src/main/java/kubatech/api/helpers/GTHelper.java
+++ b/src/main/java/kubatech/api/helpers/GTHelper.java
@@ -28,16 +28,15 @@ import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
-import com.kuba6000.mobsinfo.api.utils.ItemID;
-
import gregtech.api.metatileentity.implementations.MTEHatchEnergy;
import gregtech.api.metatileentity.implementations.MTEMultiBlockBase;
+import gregtech.api.util.GTUtility.ItemId;
import kubatech.api.implementations.KubaTechGTMultiBlockBase;
public class GTHelper {
public static long getMaxInputEU(MTEMultiBlockBase mte) {
- if (mte instanceof KubaTechGTMultiBlockBase) return ((KubaTechGTMultiBlockBase<?>) mte).getMaxInputEu();
+ if (mte instanceof KubaTechGTMultiBlockBase) return mte.getMaxInputEu();
long rEU = 0;
for (MTEHatchEnergy tHatch : mte.mEnergyHatches)
if (tHatch.isValid()) rEU += tHatch.maxEUInput() * tHatch.maxAmperesIn();
@@ -65,11 +64,14 @@ public class GTHelper {
public StackableItemSlot(int count, ItemStack stack, ArrayList<Integer> realSlots) {
this.count = count;
this.stack = stack;
+ this.hashcode = ItemId.createNoCopyWithStackSize(stack)
+ .hashCode();
this.realSlots = realSlots;
}
public final int count;
public final ItemStack stack;
+ private final int hashcode;
public final ArrayList<Integer> realSlots;
public void write(PacketBuffer buffer) throws IOException {
@@ -87,13 +89,8 @@ public class GTHelper {
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
- if (!(obj instanceof StackableItemSlot)) return false;
- StackableItemSlot other = (StackableItemSlot) obj;
- return count == other.count && ItemID.createNoCopy(stack, false)
- .hashCode()
- == ItemID.createNoCopy(other.stack, false)
- .hashCode()
- && realSlots.equals(other.realSlots);
+ if (!(obj instanceof StackableItemSlot other)) return false;
+ return count == other.count && hashcode == other.hashcode && realSlots.equals(other.realSlots);
}
}
}