Skip to content

Commit

Permalink
fix(smelting): correctly call ResourceKey.location when throwing events
Browse files Browse the repository at this point in the history
A mistaken port of these mixins to the supported platforms lead to a class cast exception
that would get caught each tick, but cause significant lag. This fixes the cast and
makes furnaces work again.

Fixes #4183
  • Loading branch information
gabizou committed Mar 9, 2025
1 parent 8056f67 commit 528e321
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public abstract class AbstractFurnaceBlockEntityMixin_Forge implements AbstractF
final var recipe = entity.bridge$getCurrentRecipe();
final ItemStackSnapshot cooking = ItemStackUtil.snapshotOf(entity.items.get(0));
final CookingEvent.Tick event = SpongeEventFactory.createCookingEventTick(cause, (FurnaceBlockEntity) entityIn, cooking, Optional.of(fuel),
recipe.map(r -> (CookingRecipe) r.value()), recipe.map(r -> (ResourceKey) (Object) r.id()));
recipe.map(r -> (CookingRecipe) r.value()), recipe.map(r -> (ResourceKey) (Object) r.id().location()));
SpongeCommon.post(event);
if (event.isCancelled()) {
return entity.cookingProgress; // dont tick down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public abstract class AbstractFurnaceBlockEntityMixin_Neo extends BaseContainerB
final var recipe = entity.bridge$getCurrentRecipe();
final ItemStackSnapshot cooking = ItemStackUtil.snapshotOf(entity.items.get(0));
final CookingEvent.Tick event = SpongeEventFactory.createCookingEventTick(cause, (FurnaceBlockEntity) entityIn, cooking, Optional.of(fuel),
recipe.map(r -> (CookingRecipe) r.value()), recipe.map(r -> (ResourceKey) (Object) r.id()));
recipe.map(r -> (CookingRecipe) r.value()), recipe.map(r -> (ResourceKey) (Object) r.id().location()));
SpongeCommon.post(event);
if (event.isCancelled()) {
return entity.cookingProgress; // dont tick down
Expand Down

0 comments on commit 528e321

Please sign in to comment.