-
Notifications
You must be signed in to change notification settings - Fork 31
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
[1.2.0] New inventory system #46
base: main
Are you sure you want to change the base?
Conversation
…into inventory-system
inventory-system Conflicts: dough-tags/pom.xml
Kudos, SonarCloud Quality Gate passed! |
dough-inventories/src/main/java/io/github/bakedlibs/dough/inventory/Menu.java
Show resolved
Hide resolved
...inventories/src/main/java/io/github/bakedlibs/dough/inventory/builders/SlotGroupBuilder.java
Outdated
Show resolved
Hide resolved
item.setAmount(amount - maxStackSize); | ||
itemInSlot.setAmount(maxStackSize); | ||
} else { | ||
itemInSlot.setAmount(Math.min(amount, maxStackSize)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can forget about the Math#min here for a slight gain in speed and just set to "amount": you have already checked that "amount" is at most maxStackSize so worst case scenario is the two are equal and Math.min will set exactly "amount" anyway, otherwise "amount" is the lower so it would again be the chosen one
if (holder instanceof Menu) { | ||
Menu inv = (Menu) holder; | ||
|
||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this fail to stop shift-clicking into filled slots? Let's say I have an "apples" group which is not interactable and filled with itemtype APPLE and I shift click a stack of apples in my inventories, the if clause is false so the event is never checked and apples get stacked into the first "apples" slots in the menu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a good idea to add something of the sort to TestMenuClicking too, just in case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just these two and what Sfiguz has brought up, otherwise LGTM.
dough-inventories/src/main/java/io/github/bakedlibs/dough/inventory/SlotGroupIterator.java
Show resolved
Hide resolved
dough-inventories/src/main/java/io/github/bakedlibs/dough/inventory/json/LayoutShape.java
Show resolved
Hide resolved
LGTM bar the comments left by Sfiguz. I'll approve once those are resolved I suppose |
…ntory/builders/SlotGroupBuilder.java Co-authored-by: Sfiguz7 <[email protected]>
Resolves #29
Rewriting the inventory system.