Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help updating to 1.11.2 if you need it #84

Open
capnkirok opened this issue Mar 26, 2017 · 0 comments
Open

Help updating to 1.11.2 if you need it #84

capnkirok opened this issue Mar 26, 2017 · 0 comments

Comments

@capnkirok
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant