From 4dad5fc27145593c14425b3e673b924155903585 Mon Sep 17 00:00:00 2001 From: Keuin Date: Mon, 28 Dec 2020 22:53:31 +0800 Subject: Version 1.3.0: add switches for all disable features. Fixed the vanilla bug that the entity trackers sometimes spam in the console. --- .../mixin/DisablePhantomSpawning.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java (limited to 'src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java') diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java new file mode 100644 index 0000000..d5788c7 --- /dev/null +++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java @@ -0,0 +1,22 @@ +package com.keuin.ohmyvanillamc.mixin; + +import com.keuin.ohmyvanillamc.OhMyVanillaMinecraft; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.gen.PhantomSpawner; +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(PhantomSpawner.class) +public class DisablePhantomSpawning { + /** + * Disable phantom spawning + * @author trueKeuin + */ + @Inject(method = "spawn", at = @At("HEAD"), cancellable = true) + public void spawn(ServerWorld serverWorld, boolean spawnMonsters, boolean spawnAnimals, CallbackInfo ci) { + if (OhMyVanillaMinecraft.disablePhantomSpawning) + ci.cancel(); + } +} -- cgit v1.2.3