Skip to content

Commit 0a3617f

Browse files
committed
Replace stepOn Redirect with WrapOperation. Fix #4261
1 parent fe5f294 commit 0a3617f

File tree

1 file changed

+6
-5
lines changed
  • src/mixins/java/org/spongepowered/common/mixin/core/world/entity

1 file changed

+6
-5
lines changed

src/mixins/java/org/spongepowered/common/mixin/core/world/entity/EntityMixin.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
import com.google.common.collect.ImmutableList;
2828
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
29+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
30+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
2931
import com.llamalad7.mixinextras.sugar.Local;
3032
import net.minecraft.commands.CommandSourceStack;
3133
import net.minecraft.core.BlockPos;
@@ -708,25 +710,24 @@ public void stopRiding() {
708710
}
709711
}
710712

711-
@Redirect(
713+
@WrapOperation(
712714
method = "move",
713715
at = @At(
714716
value = "INVOKE",
715717
target = "Lnet/minecraft/world/level/block/Block;stepOn(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/entity/Entity;)V"
716718
)
717719
)
718-
private void impl$onStepOnCollide(final Block block, final Level world, final BlockPos pos, final BlockState state, final Entity entity) {
720+
private void impl$onStepOnCollide(final Block block, final Level world, final BlockPos pos, final BlockState state, final Entity entity, final Operation<Void> original) {
719721
if (!ShouldFire.COLLIDE_BLOCK_EVENT_STEP_ON || world.isClientSide) {
720-
block.stepOn(world, pos, state, entity);
722+
original.call(block, world, pos, state, entity);
721723
return;
722724
}
723725

724726
final org.spongepowered.api.util.Direction dir = org.spongepowered.api.util.Direction.NONE;
725727
if (!SpongeCommonEventFactory.handleCollideBlockEvent(block, world, pos, state, entity, dir, SpongeCommonEventFactory.CollisionType.STEP_ON)) {
726-
block.stepOn(world, pos, state, entity);
728+
original.call(block, world, pos, state, entity);
727729
this.impl$lastCollidedBlockPos = pos;
728730
}
729-
730731
}
731732

732733
@Redirect(method = "checkInsideBlocks",

0 commit comments

Comments
 (0)