Skip to content

Commit

Permalink
Fix SpongeNeo furnace mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeregorix committed Dec 29, 2024
1 parent 7f150a0 commit 8a6fe45
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public abstract class AbstractFurnaceBlockEntityMixin_Neo extends BaseContainerB

// @formatter:off
@Shadow protected NonNullList<ItemStack> items;
@Shadow int cookingProgress;
@Shadow int cookingTimer;
// @formatter:on

private boolean neo$filledWaterBucket;
Expand All @@ -93,13 +93,13 @@ public abstract class AbstractFurnaceBlockEntityMixin_Neo extends BaseContainerB
final ItemStackSnapshot fuel = ItemStackUtil.snapshotOf(slots.get(1));

final Cause cause = PhaseTracker.getCauseStackManager().currentCause();
if (entity.cookingProgress == 0) { // Start
if (entity.cookingTimer == 0) { // Start
final CookingEvent.Start event = SpongeEventFactory.createCookingEventStart(cause, (FurnaceBlockEntity) entityIn, Optional.of(fuel),
Optional.of((CookingRecipe) recipe.value()), Optional.of((ResourceKey) (Object) recipe.id().location()));
SpongeCommon.post(event);
return !event.isCancelled();
} else { // Tick up
final ItemStackSnapshot cooking = ItemStackUtil.snapshotOf(entity.items.get(0));
final ItemStackSnapshot cooking = ItemStackUtil.snapshotOf(entity.items.getFirst());
final CookingEvent.Tick event = SpongeEventFactory.createCookingEventTick(cause, (FurnaceBlockEntity) entityIn, cooking, Optional.of(fuel),
Optional.of((CookingRecipe) recipe.value()), Optional.of((ResourceKey) (Object) recipe.id().location()));
SpongeCommon.post(event);
Expand All @@ -124,7 +124,7 @@ public abstract class AbstractFurnaceBlockEntityMixin_Neo extends BaseContainerB
recipe.map(r -> (CookingRecipe) r.value()), recipe.map(r -> (ResourceKey) (Object) r.id()));
SpongeCommon.post(event);
if (event.isCancelled()) {
return entity.cookingProgress; // dont tick down
return entity.cookingTimer; // dont tick down
}

return clampedCookTime;
Expand Down

0 comments on commit 8a6fe45

Please sign in to comment.