blob: ea978573f52fc9c3ec4fd7ac0dc2d4b558ffba9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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.CallbackInfoReturnable;
@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, CallbackInfoReturnable<Integer> cir) {
if (OhMyVanillaMinecraft.disablePhantomSpawning)
cir.setReturnValue(0);
}
}
|