diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2024-09-04 21:45:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-04 19:45:17 +0000 |
commit | 5b5311ab6cda52d33d60c23effad8a1f811e2f0f (patch) | |
tree | 1ac998acc0d1f4b0ac3a6cb8a5ba94ef964c11c4 /src/main/java/kubatech/api/helpers/GTHelper.java | |
parent | d00d97c5fd41f8c4751249674452425aaad2d5f7 (diff) | |
download | GT5-Unofficial-5b5311ab6cda52d33d60c23effad8a1f811e2f0f.tar.gz GT5-Unofficial-5b5311ab6cda52d33d60c23effad8a1f811e2f0f.tar.bz2 GT5-Unofficial-5b5311ab6cda52d33d60c23effad8a1f811e2f0f.zip |
Remove hard dep on mobs-info (#3053)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/kubatech/api/helpers/GTHelper.java')
-rw-r--r-- | src/main/java/kubatech/api/helpers/GTHelper.java | 17 |
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); } } } |