Help updating to 1.11.2 if you need it
capnkirok opened this issue ยท 0 comments
Hey lorddusk -
I was 'inspired' by some of your Bagginses code in 1.7.10 to help fix some issues with the Chest Pets in Inventory Pets. In case you haven't heard it yet from me, thank you.
Today, I spent half the day working on updating the code for Inventory Pets to 1.11.2, and ran into an issue with my Chest Pets which I finally figured out, and thought I'd return the favor. At least on git, you appear to be halfway through updating your code. Maybe you figured this out already, but I thought I'd send it your way.
Other than checking for ItemStack.EMPTY instead of null, and also returning this instead of null, the major change is that you need to do is to initialize the entire inventory with ItemStack.EMPTY (You can see this in the vanilla code under InventoryBasic).
So, in the Constructor, instead of:
inventory = new ItemStack[size];
Use:
this.inventory = NonNullList.<ItemStack>withSize(size, ItemStack.EMPTY);
This will cause a cascade of issues that need to be solved (as you no longer have an array, per se), but they are all pretty straightforward. And there is also one other location under readFromNBT that contains an initialization, which can also be changed as above.
Hope that's helpful ๐
Purplicious_Cow (capnkirok)