Skip to content

Commit

Permalink
Merge pull request #251 from ChampionAsh5357/fix/crafing-remainder
Browse files Browse the repository at this point in the history
Output Craft Remainder of a Fuel Slot
  • Loading branch information
Edivad99 authored Oct 4, 2024
2 parents e9859af + 6afea92 commit 9542d6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/java/mods/railcraft/mixin/MinecartFurnaceMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public InteractionResult interact(Player player, InteractionHand hand) {
var burnTime = itemstack.getBurnTime(null);
if (burnTime > 0 && this.fuel + burnTime <= 32000) {
if (!player.getAbilities().instabuild) {
var craftRemainder = itemstack.getCraftingRemainingItem();
itemstack.shrink(1);
if (itemstack.isEmpty()) {
player.setItemInHand(hand, craftRemainder);
}
}

this.fuel += burnTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ private void loadFuel() {
}
this.currentItemBurnTime = itemBurnTime + this.burnTime;
this.setBurnTime(this.currentItemBurnTime);
var craftRemainder = fuel.getCraftingRemainingItem();
fuel.shrink(1);
this.setItem(SLOT_FUEL, fuel.isEmpty() ? ItemStack.EMPTY : fuel);
this.setItem(SLOT_FUEL, fuel.isEmpty() ? craftRemainder : fuel);
}

public void setBurnTime(int burnTime) {
Expand Down

0 comments on commit 9542d6e

Please sign in to comment.