diff --git a/src/main/java/zone/oat/disableharmfulmobgriefs/mixin/DisableEndermanBlockSteal.java b/src/main/java/zone/oat/disableharmfulmobgriefs/mixin/DisableEndermanBlockSteal.java new file mode 100644 index 0000000..2807907 --- /dev/null +++ b/src/main/java/zone/oat/disableharmfulmobgriefs/mixin/DisableEndermanBlockSteal.java @@ -0,0 +1,27 @@ +package zone.oat.disableharmfulmobgriefs.mixin; + +import net.minecraft.entity.ai.goal.Goal; +import net.minecraft.entity.ai.goal.GoalSelector; +import net.minecraft.entity.mob.EndermanEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.Slice; + +@Mixin(EndermanEntity.class) +public class DisableEndermanBlockSteal { + @Redirect( + method = "initGoals", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/ai/goal/GoalSelector;add(ILnet/minecraft/entity/ai/goal/Goal;)V" + ), + slice = @Slice( + from = @At(value = "INVOKE", target = "Lnet/minecraft/entity/mob/EndermanEntity$PlaceBlockGoal;(Lnet/minecraft/entity/mob/EndermanEntity;)V"), + to = @At(value = "INVOKE", target = "Lnet/minecraft/entity/mob/EndermanEntity$TeleportTowardsPlayerGoal;(Lnet/minecraft/entity/mob/EndermanEntity;Ljava/util/function/Predicate;)V") + ) + ) + private void injected(GoalSelector instance, int priority, Goal goal) { + // just completely ignore it + } +} diff --git a/src/main/resources/disable-harmful-mobgriefs.mixins.json b/src/main/resources/disable-harmful-mobgriefs.mixins.json index 6151f22..3048ed1 100644 --- a/src/main/resources/disable-harmful-mobgriefs.mixins.json +++ b/src/main/resources/disable-harmful-mobgriefs.mixins.json @@ -5,6 +5,7 @@ "compatibilityLevel": "JAVA_16", "mixins": [ "DisableCreeperExplosion", + "DisableEndermanBlockSteal", "DisableFireball" ], "injectors": {