GenuineSounds

Energy Tools Fix

Aug 6th, 2014
356
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. package cofh.core.hooks;
  2.  
  3. import cofh.api.energy.IEnergyContainerItem;
  4. import net.minecraft.item.ItemStack;
  5. import net.minecraft.nbt.NBTTagCompound;
  6.  
  7. public class StackHandler {
  8.     public static boolean areItemStackTagsEqual(ItemStack s1, ItemStack s2) {
  9.         if (s1.getItem() instanceof IEnergyContainerItem && s2.getItem() instanceof IEnergyContainerItem)
  10.             return compoundsAreEqual(s1, s2);
  11.         return ItemStack.areItemStackTagsEqual(s1, s2);
  12.     }
  13.  
  14.     public static boolean compoundsAreEqual(ItemStack s1, ItemStack s2) {
  15.         if (s1.getItem() == s2.getItem()) {
  16.             NBTTagCompound c1 = (NBTTagCompound) s1.stackTagCompound.copy();
  17.             NBTTagCompound c2 = (NBTTagCompound) s2.stackTagCompound.copy();
  18.             c1.removeTag("Energy");
  19.             c2.removeTag("Energy");
  20.             return c1.equals(c2);
  21.         }
  22.         return false;
  23.     }
  24. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment