Fix handling of ItemStacks using getShareTag or Capabilites (#3171)

Temporary fix, ideally we would have a way to reference the original ItemStack so we don't need to send the full NBT data to the client.
This commit is contained in:
fscan
2017-10-26 17:59:55 +02:00
committed by GitHub
parent 74b9610b45
commit 3749742231
8 changed files with 116 additions and 181 deletions
@@ -56,6 +56,11 @@ final class AESharedItemStack implements Comparable<AESharedItemStack>
return this.itemDamage;
}
int getItemID()
{
return this.itemId;
}
@Override
public int hashCode()
{
@@ -104,7 +109,17 @@ final class AESharedItemStack implements Comparable<AESharedItemStack>
return damageValue;
}
return this.compareNBT( b.getDefinition() );
final int nbt = this.compareNBT( b.getDefinition() );
if( nbt != 0 )
{
return nbt;
}
if( !this.itemStack.areCapsCompatible( b.getDefinition() ) )
{
return System.identityHashCode( this.itemStack ) - System.identityHashCode( b.getDefinition() );
}
return 0;
}
private int compareNBT( final ItemStack b )