From 75f26f4ed9011e9dd12f5b49b26b94f8f4dacac1 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 15 Jan 2021 00:42:54 +0800 Subject: Version 1.4.0: supports reintroducing llama item duplication. Add configuration file. --- .../ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java') diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java index 040c352..3af7941 100644 --- a/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java +++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java @@ -5,17 +5,20 @@ 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.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(WanderingTraderManager.class) public class DisableWanderingTraderSpawning { /** * Disable ticking + * * @author trueKeuin */ - @Inject(method = "tick", at = @At("HEAD"), cancellable = true) - public void tick(CallbackInfo ci) { - if (OhMyVanillaMinecraft.disableWanderingTraderSpawning) + @Inject(method = "spawn", at = @At("HEAD"), cancellable = true) + public void tick(CallbackInfoReturnable ci) { + if (OhMyVanillaMinecraft.getConfiguration().isDisableWanderingTraderSpawning()) { + ci.setReturnValue(0); ci.cancel(); + } } } -- cgit v1.2.3