diff options
author | Keuin <[email protected]> | 2021-01-15 00:42:54 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2021-01-15 00:42:54 +0800 |
commit | 75f26f4ed9011e9dd12f5b49b26b94f8f4dacac1 (patch) | |
tree | 7520c0c10220ec06624bd87c6115d564146a40a5 /src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java | |
parent | 6f84d79bc8452a2e37644e6f0419477b70a09e69 (diff) |
Version 1.4.0: supports reintroducing llama item duplication. Add configuration file.
Diffstat (limited to 'src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java')
-rw-r--r-- | src/main/java/com/keuin/ohmyvanillamc/mixin/DisableWanderingTraderSpawning.java | 11 |
1 files changed, 7 insertions, 4 deletions
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<Integer> ci) { + if (OhMyVanillaMinecraft.getConfiguration().isDisableWanderingTraderSpawning()) { + ci.setReturnValue(0); ci.cancel(); + } } } |