mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-02-05 21:50:04 +00:00
Make upgrade crafting even more lenient
This now allows items with empty tags to equal those with no tag.
This commit is contained in:
parent
105c66127c
commit
54b9966feb
@ -10,6 +10,7 @@ import net.minecraft.entity.Entity;
|
|||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@ -54,9 +55,17 @@ public class InventoryUtil
|
|||||||
{
|
{
|
||||||
if( a == b ) return true;
|
if( a == b ) return true;
|
||||||
if( a.isEmpty() ) return !b.isEmpty();
|
if( a.isEmpty() ) return !b.isEmpty();
|
||||||
return a.getItem() == b.getItem()
|
|
||||||
&& a.getItemDamage() == b.getItemDamage()
|
if( a.getItem() != b.getItem() || a.getItemDamage() != b.getItemDamage() ) return false;
|
||||||
&& ItemStack.areItemStackShareTagsEqual( a, b );
|
|
||||||
|
// A more expanded form of ItemStack.areItemStackShareTagsEqual, but allowing an empty tag to be equal to a
|
||||||
|
// null one.
|
||||||
|
NBTTagCompound shareTagA = a.getItem().getNBTShareTag( a );
|
||||||
|
NBTTagCompound shareTagB = b.getItem().getNBTShareTag( b );
|
||||||
|
if( shareTagA == shareTagB ) return true;
|
||||||
|
if( shareTagA == null ) return shareTagB.isEmpty();
|
||||||
|
if( shareTagB == null ) return shareTagA.isEmpty();
|
||||||
|
return shareTagA.equals( shareTagB );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
Loading…
x
Reference in New Issue
Block a user