From ac5bdf4a3ca555fa4638d6fad6b06b9941ad3ba2 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 18 Dec 2020 20:52:04 +0800 Subject: First version: implemented disabling fish schooling. --- .../ohmyvanillamc/mixin/DisableFishSchooling.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/com/keuin/ohmyvanillamc/mixin/DisableFishSchooling.java (limited to 'src/main/java/com/keuin/ohmyvanillamc/mixin') diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableFishSchooling.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableFishSchooling.java new file mode 100644 index 0000000..28342c9 --- /dev/null +++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableFishSchooling.java @@ -0,0 +1,21 @@ +package com.keuin.ohmyvanillamc.mixin; + +import com.keuin.ohmyvanillamc.OhMyVanillaMinecraft; +import net.minecraft.entity.passive.SchoolingFishEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(SchoolingFishEntity.class) +public class DisableFishSchooling { + /** + * @reason To disable SchoolingFish schooling. + * @author trueKeuin + */ + @Inject(method = "moveTowardLeader()V", at = @At("HEAD")) + protected void moveTowardLeader(CallbackInfo ci) { + if (OhMyVanillaMinecraft.disableFishSchooling) + ci.cancel(); + } +} -- cgit v1.2.3