diff --git a/gradle.properties b/gradle.properties index 98b8554..0ac5df5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,5 +3,5 @@ org.gradle.jvmargs=-Xmx1G mc_version=1.18.2 yarn_version=1.18.2+build.1 fabric_version=0.13.3 -mod_version=1.1.1 +mod_version=1.1.2 maven_group=dev.dubhe diff --git a/src/main/java/dev/dubhe/skyland/SkyLand.java b/src/main/java/dev/dubhe/skyland/SkyLand.java index b824d38..a4f5422 100644 --- a/src/main/java/dev/dubhe/skyland/SkyLand.java +++ b/src/main/java/dev/dubhe/skyland/SkyLand.java @@ -5,6 +5,7 @@ public class SkyLand implements ModInitializer { public static final GameRules.Key LC = GameRules.register("qnmdLC", GameRules.Category.MOBS, GameRules.BooleanRule.create(false)); + public static final GameRules.Key CHIEFTAIN = GameRules.register("chieftainMode", GameRules.Category.MOBS, GameRules.BooleanRule.create(false)); @Override public void onInitialize() { diff --git a/src/main/java/dev/dubhe/skyland/mixin/WanderingTraderManagerMixin.java b/src/main/java/dev/dubhe/skyland/mixin/WanderingTraderManagerMixin.java new file mode 100644 index 0000000..d3b8c78 --- /dev/null +++ b/src/main/java/dev/dubhe/skyland/mixin/WanderingTraderManagerMixin.java @@ -0,0 +1,18 @@ +package dev.dubhe.skyland.mixin; + +import dev.dubhe.skyland.SkyLand; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.WanderingTraderManager; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.util.Random; + +@Mixin(WanderingTraderManager.class) +public class WanderingTraderManagerMixin { + @Redirect(method = "trySpawn", at = @At(value = "INVOKE", target = "Ljava/util/Random;nextInt(I)I")) + private int spawnX10(Random random, int value, ServerWorld world) { + return world.getGameRules().getBoolean(SkyLand.CHIEFTAIN) ? 0 : random.nextInt(value); + } +} diff --git a/src/main/resources/assets/skyland/lang/en_us.json b/src/main/resources/assets/skyland/lang/en_us.json index 7226188..b048a65 100644 --- a/src/main/resources/assets/skyland/lang/en_us.json +++ b/src/main/resources/assets/skyland/lang/en_us.json @@ -1,4 +1,5 @@ { "generator.skyland": "SkyLand", - "gamerule.qnmdLC": "qnmdLC" + "gamerule.qnmdLC": "qnmdLC", + "gamerule.chieftainMode": "Chieftain Mode" } \ No newline at end of file diff --git a/src/main/resources/assets/skyland/lang/zh_cn.json b/src/main/resources/assets/skyland/lang/zh_cn.json index 5e375b3..29c6b61 100644 --- a/src/main/resources/assets/skyland/lang/zh_cn.json +++ b/src/main/resources/assets/skyland/lang/zh_cn.json @@ -1,4 +1,5 @@ { "generator.skyland": "空岛", - "gamerule.qnmdLC": "忽略LC值影响" + "gamerule.qnmdLC": "忽略LC值影响", + "gamerule.chieftainMode": "非酋模式" } \ No newline at end of file diff --git a/src/main/resources/assets/skyland/lang/zh_hk.json b/src/main/resources/assets/skyland/lang/zh_hk.json index 15536c4..df7125f 100644 --- a/src/main/resources/assets/skyland/lang/zh_hk.json +++ b/src/main/resources/assets/skyland/lang/zh_hk.json @@ -1,4 +1,5 @@ { "generator.skyland": "空島", - "gamerule.qnmdLC": "忽略LC值影響" + "gamerule.qnmdLC": "忽略LC值影響", + "gamerule.chieftainMode": "非酋模式" } \ No newline at end of file diff --git a/src/main/resources/assets/skyland/lang/zh_tw.json b/src/main/resources/assets/skyland/lang/zh_tw.json index 15536c4..df7125f 100644 --- a/src/main/resources/assets/skyland/lang/zh_tw.json +++ b/src/main/resources/assets/skyland/lang/zh_tw.json @@ -1,4 +1,5 @@ { "generator.skyland": "空島", - "gamerule.qnmdLC": "忽略LC值影響" + "gamerule.qnmdLC": "忽略LC值影響", + "gamerule.chieftainMode": "非酋模式" } \ No newline at end of file diff --git a/src/main/resources/skyland.mixins.json b/src/main/resources/skyland.mixins.json index ffc0055..c507801 100644 --- a/src/main/resources/skyland.mixins.json +++ b/src/main/resources/skyland.mixins.json @@ -6,7 +6,8 @@ "EnderDragonFightMixin", "GeneratorOptionsMixin", "RegistryMixin", - "SpawnHelperMixin" + "SpawnHelperMixin", + "WanderingTraderManagerMixin" ], "client": [], "injectors": {