diff --git a/gradle.properties b/gradle.properties index 805dd7d..07c883b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G # Mod Properties - mod_version = 0.21.1 + mod_version = 0.22 maven_group = com.github.zly2006 archives_base_name = carpet-sls-addition diff --git a/rules.md b/rules.md index 2596fcf..49fc80c 100644 --- a/rules.md +++ b/rules.md @@ -79,3 +79,7 @@ datapack enable elytra-craftable ### spectatorCannotUseLeash When player becomes spectator, the leash will be detached. + +### armadilloImmediateDespawns + +Armadillos will despawn immediately if they are 128 blocks away from the player. diff --git a/rules_zh.md b/rules_zh.md index cd259f2..ab2fbe4 100644 --- a/rules_zh.md +++ b/rules_zh.md @@ -80,3 +80,7 @@ datapack enable elytra-craftable ### spectatorCannotUseLeash 当玩家成为旁观者时,拴绳将断开。 + +### armadilloImmediateDespawns + +当犰狳距离玩家超过 128 格时,它们将立即消失。 diff --git a/src/main/java/com/github/zly2006/carpetslsaddition/SLSCarpetSettings.java b/src/main/java/com/github/zly2006/carpetslsaddition/SLSCarpetSettings.java index f5a4937..acc3ed8 100644 --- a/src/main/java/com/github/zly2006/carpetslsaddition/SLSCarpetSettings.java +++ b/src/main/java/com/github/zly2006/carpetslsaddition/SLSCarpetSettings.java @@ -8,67 +8,55 @@ public class SLSCarpetSettings { public static final String FROM_AMS = "AMS"; public static final String SLSA = "SLS"; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.SURVIVAL}) public static boolean obtainableReinforcedDeepSlate = false; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.CREATIVE}) public static boolean creativeNoInfinitePickup = false; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.OPTIMIZATION}) public static boolean noBatSpawning = false; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.FEATURE}) public static boolean canUseHatCommand = false; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.FEATURE}) public static boolean canUseSitCommand = false; - /** Carpet SLS Addition original **/ - @Rule(categories = {SLSA}, strict = false, options = {"#none"}) + @Rule(categories = {SLSA}, strict = false, options = {"#none", "bot_"}) public static String botPrefix = "#none"; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA}) public static long botMaxOnlineTime = -1; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.FEATURE}) public static boolean creativeObeyEnchantmentRule = false; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.FEATURE}) public static boolean fakePlayersNotOccupiedSleepQuota = false; - /** From Plusls Carpet Addition **/ @Rule(categories = {SLSA, RuleCategory.FEATURE, NEED_CLIENT}) public static boolean emptyShulkerBoxStack = false; - /** From Plusls Carpet Addition **/ @Rule(categories = {SLSA, RuleCategory.FEATURE}) public static boolean playerSit = false; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.FEATURE}) public static boolean endermanCanPickUpMushroom = true; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.CREATIVE}) public static boolean oldRedstoneConnectionLogic = false; - /** From Carpet AMS Addition **/ + // Ported from Carpet AMS Addition @Rule(categories = {SLSA, FROM_AMS, RuleCategory.OPTIMIZATION}) public static boolean optimizedOnDragonRespawn = false; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.FEATURE}) public static boolean elytraCraftable = false; - /** Carpet SLS Addition original **/ @Rule(categories = {SLSA, RuleCategory.FEATURE}) public static boolean spectatorCannotUseLeash = false; + + @Rule(categories = {SLSA, RuleCategory.FEATURE}) + public static boolean armadilloImmediateDespawns = false; } diff --git a/src/main/java/com/github/zly2006/carpetslsaddition/mixin/entity/MixinArmadilloEntity.java b/src/main/java/com/github/zly2006/carpetslsaddition/mixin/entity/MixinArmadilloEntity.java new file mode 100644 index 0000000..1f8475f --- /dev/null +++ b/src/main/java/com/github/zly2006/carpetslsaddition/mixin/entity/MixinArmadilloEntity.java @@ -0,0 +1,20 @@ +package com.github.zly2006.carpetslsaddition.mixin.entity; + +import com.github.zly2006.carpetslsaddition.SLSCarpetSettings; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.entity.passive.ArmadilloEntity; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(ArmadilloEntity.class) +public abstract class MixinArmadilloEntity extends AnimalEntity { + protected MixinArmadilloEntity(EntityType entityType, World world) { + super(entityType, world); + } + + @Override + public boolean canImmediatelyDespawn(double distanceSquared) { + return SLSCarpetSettings.armadilloImmediateDespawns; + } +} diff --git a/src/main/resources/assets/slsaddition/lang/en_us.json b/src/main/resources/assets/slsaddition/lang/en_us.json index 8a18c93..1c019cd 100644 --- a/src/main/resources/assets/slsaddition/lang/en_us.json +++ b/src/main/resources/assets/slsaddition/lang/en_us.json @@ -48,6 +48,7 @@ "carpet.rule.elytraCraftable.desc": "Make elytra craftable for Minecraft 1.20.6+ (eltra wont disappear when crafting)", "carpet.rule.botMaxOnlineTime.desc": "Set the maximum living time of the bot which create by carpet sls addition.", "carpet.rule.spectatorCannotUseLeash.desc": "If a player is a spectator, they cannot use the leash.", + "carpet.rule.armadilloImmediateDespawns.desc": "Armadillos will despawn immediately if they are 128 blocks away from the player.", "carpet.rule.skipTicksForJoblessVillager.extra.0": "Set to 0 to maintain the vanilla behavior", "carpet.rule.skipTicksForJoblessVillager.extra.1": "Set to a number greater than 0, the value will be +1 based on the setting", diff --git a/src/main/resources/assets/slsaddition/lang/zh_cn.json b/src/main/resources/assets/slsaddition/lang/zh_cn.json index 8946e2e..96680de 100644 --- a/src/main/resources/assets/slsaddition/lang/zh_cn.json +++ b/src/main/resources/assets/slsaddition/lang/zh_cn.json @@ -25,6 +25,7 @@ "carpet.rule.printStackTraceOnVillagerSpawn.name": "打印村民生成报告", "carpet.rule.botMaxOnlineTime.name": "Bot最大存活时间", "carpet.rule.spectatorCannotUseLeash.name": "观察者模式禁用拴绳", + "carpet.rule.armadilloImmediateDespawns.desc": "当犰狳远离玩家128格时,立即消失", "carpet.rule.obtainableReinforcedDeepSlate.desc": "当铁砧砸在9*64个深板岩的掉落物上时,可以获得强化深板岩", "carpet.rule.skipTicksForJoblessVillager.desc": "对于无业/傻子村民,执行设定数量的tick运算后,跳过1tick的运算", diff --git a/src/main/resources/slsaddition.mixins.json b/src/main/resources/slsaddition.mixins.json index a70ec0e..4d896eb 100644 --- a/src/main/resources/slsaddition.mixins.json +++ b/src/main/resources/slsaddition.mixins.json @@ -12,6 +12,7 @@ "datapack.MixinVanillaResourcePackProvider", "elytra.MixinElytraItem", "elytra.MixinItem", + "entity.MixinArmadilloEntity", "entity.MixinArmorStandEntity", "entity.MixinBoatEntity", "entity.MixinEnderDragonFight",