diff options
Diffstat (limited to 'src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java')
-rw-r--r-- | src/main/java/com/keuin/ohmyvanillamc/mixin/DisablePhantomSpawning.java | 22 |
1 files changed, 22 insertions, 0 deletions
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(); + } +} |