You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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];
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)
The text was updated successfully, but these errors were encountered:
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)
The text was updated successfully, but these errors were encountered: