Skip to content

Commit

Permalink
Fix part builder leftover dupe (#4835)
Browse files Browse the repository at this point in the history
Happens with recipes that are an exact multiple of the input material size, and with recipes that cost more than the input material size for inputs with leftovers
  • Loading branch information
KnightMiner committed May 1, 2022
1 parent 935278f commit 454a2d0
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ default ItemStack getLeftover(PartBuilderContainerWrapper inventoryWrapper) {
if (recipe != null) {
int value = recipe.getValue();
if (value > 1) {
int remainder = value - getCost() % value;
if (remainder > 0) {
int remainder = (value - getCost()) % value;
if (remainder < 0) {
remainder += value;
}
if (remainder != 0) {
ItemStack leftover = recipe.getLeftover();
leftover.setCount(leftover.getCount() * remainder);
return leftover;
Expand Down

0 comments on commit 454a2d0

Please sign in to comment.