From 673425e3a36950e70e17a7e960d12ba20a40ce06 Mon Sep 17 00:00:00 2001 From: Gabriel Harris-Rouquette Date: Sat, 5 Mar 2022 14:35:30 -0800 Subject: [PATCH] Redirect isSteppingCarefully for better sponge compatibility Signed-off-by: Gabriel Harris-Rouquette --- .../abnormals_core/core/mixin/EntityMixin.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/minecraftabnormals/abnormals_core/core/mixin/EntityMixin.java b/src/main/java/com/minecraftabnormals/abnormals_core/core/mixin/EntityMixin.java index cd0f8288..137576ac 100644 --- a/src/main/java/com/minecraftabnormals/abnormals_core/core/mixin/EntityMixin.java +++ b/src/main/java/com/minecraftabnormals/abnormals_core/core/mixin/EntityMixin.java @@ -8,7 +8,6 @@ import com.minecraftabnormals.abnormals_core.common.world.storage.tracking.TrackedDataManager; import com.minecraftabnormals.abnormals_core.core.AbnormalsCore; import com.minecraftabnormals.abnormals_core.core.events.EntityWalkEvent; -import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; @@ -28,9 +27,12 @@ import java.util.Set; @Mixin(Entity.class) -public final class EntityMixin implements IDataManager { +public abstract class EntityMixin implements IDataManager { @Shadow - private World level; + public World level; + + @Shadow + protected abstract BlockPos getOnPos(); private Map, DataEntry> dataMap = Maps.newHashMap(); private boolean dirty = false; @@ -131,10 +133,8 @@ public void read(CompoundNBT compound, CallbackInfo info) { } } - @Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;stepOn(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/Entity;)V")) - private void onEntityWalk(Block block, World world, BlockPos pos, Entity entity) { - if (!EntityWalkEvent.onEntityWalk(world, pos, entity)) { - block.stepOn(world, pos, entity); - } + @Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;isSteppingCarefully()Z")) + private boolean onIsSteppingCarefully(Entity instance) { + return instance.isSteppingCarefully() && !EntityWalkEvent.onEntityWalk(this.level, this.getOnPos(), instance); } }