Closed Machine-Maker closed 3 weeks ago
It's possible that ItemStack#equals and ItemStack#hashCode should also directly delegate to a craftitemstack. I think that's probably most correct.
This doesn't handle empty itemstack (ItemStack#empty) which are still full api stack without server side equivalent and will throw a NPE for most methods.
I think I should just be able to change empty to return ItemStack.create(Material.AIR)
. It'd have a stack size of 1 however, should I instead add a bridge method to create a truly empty stack? just by returning a copy of nms-ItemStack.EMPTY?
Another issue is that asNMSCopy doesn't accept null itemstack anymore so doing /clear for example throw a NPE too via the PrepareItemCraftEvent.
This essentially removes API-only itemstacks without changing ItemStack to an interface, that will come later.
Just adds a field in api-ItemStack that should always be a CraftItemStack which the api-ItemStack will wrap around. CraftItemStack has to override any methods on api-ItemStack that use this
craftDelegate
to avoid recursion loops.Download the paperclip jar for this pull request: paper-10852.zip