Skip to content

Commit

Permalink
chore: update to 1.21.4-pre2
Browse files Browse the repository at this point in the history
- Furnaces changed field names for burn times and cooking times
  - I assume these fields are correctly renamed for their accessors, they appear to function the same way for their Data API Keys
  • Loading branch information
gabizou committed Nov 26, 2024
1 parent 04733e4 commit bb8e3f0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mixinConfigs=mixins.sponge.accessors.json,mixins.sponge.api.json,mixins.sponge.c
mixins.sponge.tracker.json,mixins.sponge.ipforward.json,mixins.sponge.optimization.json
superClassChanges=common.superclasschange

minecraftVersion=1.21.4-pre1
minecraftVersion=1.21.4-pre2
recommendedVersion=0-SNAPSHOT

org.gradle.dependency.verification.console=verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
@Mixin(AbstractFurnaceBlockEntity.class)
public interface AbstractFurnaceBlockEntityAccessor {

@Accessor("litTime") int accessor$litTime();
@Accessor("litTotalTime") int accessor$litTime();

@Accessor("litTime") void accessor$litTime(final int litTime);
@Accessor("litTotalTime") void accessor$litTime(final int litTime);

@Accessor("litDuration") int accessor$litDuration();
@Accessor("litTimeRemaining") int accessor$litDuration();

@Accessor("litDuration") void accessor$litDuration(final int litDuration);
@Accessor("litTimeRemaining") void accessor$litDuration(final int litDuration);

@Accessor("cookingProgress") int accessor$cookingProgress();
@Accessor("cookingTimer") int accessor$cookingProgress();

@Accessor("cookingProgress") void accessor$cookingProgress(final int cookingProgress);
@Accessor("cookingTimer") void accessor$cookingProgress(final int cookingProgress);

@Accessor("cookingTotalTime") int accessor$cookingTotalTime();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
public abstract class AbstractFurnaceBlockEntityMixin_API extends BaseContainerBlockEntityMixin_API implements FurnaceBlockEntity {

// @formatter:off
@Shadow int litTime;
@Shadow int litDuration;
@Shadow int cookingProgress;
@Shadow int litTimeRemaining;
@Shadow int litTotalTime;
@Shadow int cookingTimer;
@Shadow int cookingTotalTime;
@Shadow protected NonNullList<ItemStack> items;
// @formatter:on
Expand All @@ -64,9 +64,9 @@ public abstract class AbstractFurnaceBlockEntityMixin_API extends BaseContainerB
@Override
public DataContainer toContainer() {
return super.toContainer()
.set(Constants.TileEntity.Furnace.BURN_TIME, this.litTime)
.set(Constants.TileEntity.Furnace.BURN_TIME_TOTAL, this.litDuration)
.set(Constants.TileEntity.Furnace.COOK_TIME, this.cookingProgress)
.set(Constants.TileEntity.Furnace.BURN_TIME, this.litTimeRemaining)
.set(Constants.TileEntity.Furnace.BURN_TIME_TOTAL, this.litTotalTime)
.set(Constants.TileEntity.Furnace.COOK_TIME, this.cookingTimer)
.set(Constants.TileEntity.Furnace.COOK_TIME_TOTAL, this.cookingTotalTime);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public abstract class AbstractFurnaceBlockEntityMixin extends BaseContainerBlock

// @Formatter:off
@Shadow protected NonNullList<ItemStack> items;
@Shadow int cookingProgress;
@Shadow int cookingTimer;
@Shadow int cookingTotalTime;

// @Formatter:on
Expand Down Expand Up @@ -130,7 +130,7 @@ public abstract class AbstractFurnaceBlockEntityMixin extends BaseContainerBlock
shift = At.Shift.BEFORE,
value = "FIELD",
opcode = Opcodes.PUTFIELD,
target = "Lnet/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity;cookingProgress:I"
target = "Lnet/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity;cookingTimer:I"
),
slice = @Slice(
from = @At(
Expand All @@ -149,7 +149,7 @@ public abstract class AbstractFurnaceBlockEntityMixin extends BaseContainerBlock
}

private void impl$callInteruptSmeltEvent() {
if (this.cookingProgress > 0) {
if (this.cookingTimer > 0) {
final ItemStackSnapshot fuel = ItemStackUtil.snapshotOf(this.items.get(1));
final Cause cause = PhaseTracker.getCauseStackManager().currentCause();
final var recipe = this.bridge$getCurrentRecipe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public abstract class AbstractFurnaceBlockEntityMixin_Vanilla extends BaseContai

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

private boolean vanilla$filledWaterBucket;
Expand All @@ -92,7 +92,7 @@ public abstract class AbstractFurnaceBlockEntityMixin_Vanilla extends BaseContai
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);
Expand Down Expand Up @@ -122,7 +122,7 @@ public abstract class AbstractFurnaceBlockEntityMixin_Vanilla extends BaseContai
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
return entity.cookingTimer; // dont tick down
}

return clampedCookTime;
Expand Down

0 comments on commit bb8e3f0

Please sign in to comment.