summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java
blob: 3af79417fa2471e9c8e835235c05d9f2736f0b2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.keuin.ohmyvanillamc.mixin;

import com.keuin.ohmyvanillamc.OhMyVanillaMinecraft;
import net.minecraft.world.WanderingTraderManager;
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(WanderingTraderManager.class)
public class DisableWanderingTraderSpawning {
    /**
     * Disable ticking
     *
     * @author trueKeuin
     */
    @Inject(method = "spawn", at = @At("HEAD"), cancellable = true)
    public void tick(CallbackInfoReturnable<Integer> ci) {
        if (OhMyVanillaMinecraft.getConfiguration().isDisableWanderingTraderSpawning()) {
            ci.setReturnValue(0);
            ci.cancel();
        }
    }
}