diff --git a/.gitignore b/.gitignore index d8dd4e6a..7adabc49 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ .gradle/ .idea/ build/ - -/run/* -!/run/eula.txt -!/run/options.txt -!/run/server.properties +logs/ diff --git a/common.gradle b/common.gradle index 598c85a4..11c68f63 100644 --- a/common.gradle +++ b/common.gradle @@ -29,6 +29,10 @@ dependencies { // mods modImplementation "carpet:fabric-carpet:${project.carpet_core_version}" + + // libraries + implementation "org.yaml:snakeyaml:${project.snakeyaml_version}" + include "org.yaml:snakeyaml:${project.snakeyaml_version}" } loom { diff --git a/gradle.properties b/gradle.properties index e282972a..a55b6609 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,10 @@ org.gradle.jvmargs = -Xmx4G loader_version = 0.14.14 # Mod Properties -mod_version = 1.14.0 +mod_version = 2.0.1 maven_group = carpetamsaddition archives_base_name = Carpet-AMS-Addition + +# Dependencies +# https://mvnrepository.com/artifact/org.yaml/snakeyaml +snakeyaml_version = 2.0 diff --git a/readme_folder/en_us/rules_en.md b/readme_folder/en_us/rules_en.md index 2ade3b98..8af9c73c 100644 --- a/readme_folder/en_us/rules_en.md +++ b/readme_folder/en_us/rules_en.md @@ -450,6 +450,15 @@ Sculk shrieker can be moved by piston or sticky piston. - Suggested options: `false`, `true` - Categroies: `AMS`, `FEATURE`, `AMS_movable` +## movableCalibratedSculkSensor + +Calibrated Sculk Sensor can be moved by piston or sticky piston. + +- Type: `boolean` +- Default: `false` +- Suggested options: `false` , `true` +- Categroies: `AMS` , `FEATURE` , `AMS_movable` + ## craftableEnchantedGoldApple Enchanted gold apple can be crafted using gold block and apple, which is the original crafting recipe before 15w44a. @@ -508,7 +517,6 @@ Dispenser can be crafted more flexible. It can be crafted using bow and dropper, - Suggested options: `false`, `true` - Categroies: `AMS`, `SURVIVAL`, `CRAFTING` - ## betterCraftablePolishedBlackStoneButton Use deepslate to crafted polished_blackstone_button in minecraft. diff --git a/readme_folder/rules_cn.md b/readme_folder/rules_cn.md index 563c4a7b..fabe3ef3 100644 --- a/readme_folder/rules_cn.md +++ b/readme_folder/rules_cn.md @@ -5,7 +5,6 @@ ## 超级弓 (superBow) 开启后,可以让弓同时拥有无限和经验修补附魔。 -> 谁能拒绝一把同时拥有无限和经验修补的弓呢? - 类型: `boolean` @@ -116,7 +115,6 @@ ## 地狱可放水 (netherWaterPlacement) 开启后,玩家可通过使用水桶的方式在地狱维度中放置水源。 -> 很古老的需求。 - 类型: `boolean` - 默认值: `false` @@ -127,7 +125,6 @@ ## 💻易碎深板岩 (softDeepslate) 开启后,深板岩的挖掘硬度将与石头相同(均可在急迫二效果下用效率5钻石镐进行瞬间挖掘)。 -> 如果挖沟时面对无法秒破的深板岩很恼火那么可以使用此规则来偷个懒。 - 类型: `boolean` - 默认值: `false` @@ -138,7 +135,6 @@ ## 💻易碎黑曜石 (softObsidian) 开启后,黑曜石的挖掘硬度将与深板岩相同。 -> 可以用来在面对大量黑曜石时偷个懒。 - 类型: `boolean` - 默认值: `false` @@ -149,7 +145,6 @@ ## 伪和平(fakePeace) 开启后,所有生物不会生成,但不影响困难难度(类似伪和平)。 -> 用于在镜像服快速的实现不刷怪物且不切换难度。 - 类型: `boolean` - 默认值: `false` @@ -455,6 +450,7 @@ - 参考选项: `false` , `true` - 分类: `AMS` , `FEATURE` , `AMS_movable` + ## 可移动幽匿感测体(movableSculkSensor) 开启后,幽匿感测体可以被活塞/黏性活塞推动。 @@ -464,6 +460,17 @@ - 参考选项: `false` , `true` - 分类: `AMS` , `FEATURE` , `AMS_movable` + +## 可移动校频幽匿感测体(movableCalibratedSculkSensor) + +开启后,校频幽匿感测体可以被活塞/黏性活塞推动。 + +- 类型: `boolean` +- 默认值: `false` +- 参考选项: `false` , `true` +- 分类: `AMS` , `FEATURE` , `AMS_movable` + + ## 可移动幽匿尖啸体(movableSculkShrieker) 开启后,幽匿尖啸体可以被活塞/黏性活塞推动。 diff --git a/src/main/java/club/mcams/carpet/AmsServer.java b/src/main/java/club/mcams/carpet/AmsServer.java index 3b8bdc04..f26fc53c 100644 --- a/src/main/java/club/mcams/carpet/AmsServer.java +++ b/src/main/java/club/mcams/carpet/AmsServer.java @@ -12,27 +12,23 @@ import carpet.script.bundled.BundledModule; //#endif -import club.mcams.carpet.commands.chunkloadingCommandRegistry; -import club.mcams.carpet.function.ChunkLoading; -import club.mcams.carpet.logging.AmsCarpetLoggerRegistry; -import club.mcams.carpet.util.AmsCarpetTranslations; +import club.mcams.carpet.settings.CarpetRuleRegistrar; +import club.mcams.carpet.translations.AMSTranslations; +import club.mcams.carpet.translations.TranslationConstants; import club.mcams.carpet.util.Logging; import club.mcams.carpet.util.recipes.CraftingRule; import com.google.common.base.CaseFormat; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import com.mojang.brigadier.CommandDispatcher; - import net.minecraft.resource.ResourcePackManager; import net.minecraft.server.MinecraftServer; import net.minecraft.server.command.ReloadCommand; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.WorldSavePath; //#if MC>=11900 //$$ import net.minecraft.command.CommandRegistryAccess; @@ -56,33 +52,43 @@ public class AmsServer implements CarpetExtension { public static MinecraftServer minecraftServer; private static final AmsServer INSTANCE = new AmsServer(); + public static final String fancyName = "Carpet AMS Addition"; public static final String name = AmsServerMod.getModId(); - public static final String MOD_NAME = "Carpet AMS Addition"; - public static final Logger LOGGER = LogManager.getLogger(MOD_NAME); + public static final String compactName = name.replace("-",""); // carpetamsaddition + public static final Logger LOGGER = LogManager.getLogger(fancyName); @Override - public String version() { - return name; + public Map canHasTranslations(String lang) { + Map trimmedTranslation = Maps.newHashMap(); + String prefix = TranslationConstants.CARPET_TRANSLATIONS_KEY_PREFIX; + AMSTranslations.getTranslation(lang).forEach((key, value) -> { + if (key.startsWith(prefix)) { + String newKey = key.substring(prefix.length()); + //#if MC>=11900 + //$$ newKey = "carpet." + newKey; + //#endif + trimmedTranslation.put(newKey, value); + } + }); + return trimmedTranslation; } - public void onPlayerLoggedOut(ServerPlayerEntity player) { - ChunkLoading.onPlayerDisconnect(player); + + @Override + public String version() { + return AmsServerMod.getModId(); } public static void init() { CarpetServer.manageExtension(INSTANCE); - } - - @Override - public Map canHasTranslations(String lang) { - return AmsCarpetTranslations.getTranslationFromResourcePath(lang); + AMSTranslations.loadTranslations(); } @Override public void onGameStarted() { // let's /carpet handle our few simple settings - CarpetServer.settingsManager.parseSettingsClass(AmsServerSettings.class); - LOGGER.info(MOD_NAME + " " + "v" + AmsServerMod.getVersion() + " 载入成功"); + LOGGER.info(fancyName + " " + "v" + AmsServerMod.getVersion() + " 载入成功"); LOGGER.info("开源链接:https://github.com/Minecraft-AMS/Carpet-AMS-Addition"); LOGGER.info("BUG反馈:https://github.com/Minecraft-AMS/Carpet-AMS-Addition/issues"); + CarpetRuleRegistrar.register(CarpetServer.settingsManager, AmsServerSettings.class); } @Override @@ -102,28 +108,9 @@ public void onServerClosed(MinecraftServer server) { } } - //#if MC>=11900 - //$$ @Override - //$$ public void registerCommands(CommandDispatcher dispatcher, final CommandRegistryAccess commandBuildContext) { - //$$ chunkloadingCommandRegistry.register(dispatcher); - //$$ } - //#else - @Override - public void registerCommands(CommandDispatcher dispatcher) { - chunkloadingCommandRegistry.register(dispatcher); - } - //#endif - - @Override - public void onPlayerLoggedIn(ServerPlayerEntity player) { - ChunkLoading.onPlayerConnect(player); - } - - @Override - public void registerLoggers() { - AmsCarpetLoggerRegistry.registerLoggers(); - } - + /** + * From Rug Mod + */ @Override public void onServerLoadedWorlds(MinecraftServer server) { String datapackPath = server.getSavePath(WorldSavePath.DATAPACKS).toString(); @@ -141,13 +128,13 @@ public void onServerLoadedWorlds(MinecraftServer server) { Files.createDirectories(new File(datapackPath + "data/ams/recipes").toPath()); Files.createDirectories(new File(datapackPath + "data/ams/advancements").toPath()); Files.createDirectories(new File(datapackPath + "data/minecraft/recipes").toPath()); - copyFile("assets/carpet-ams-addition/AmsRecipeTweakPack/pack.mcmeta", datapackPath + "pack.mcmeta"); + copyFile("assets/carpetamsaddition/AmsRecipeTweakPack/pack.mcmeta", datapackPath + "pack.mcmeta"); } catch (IOException e) { Logging.logStackTrace(e); } copyFile( - "assets/carpet-ams-addition/AmsRecipeTweakPack/ams/advancements/root.json", + "assets/carpetamsaddition/AmsRecipeTweakPack/ams/advancements/root.json", datapackPath + "data/ams/advancements/root.json" ); @@ -174,19 +161,19 @@ public void onServerLoadedWorlds(MinecraftServer server) { private void registerCraftingRule(String ruleName, String[] recipes, String recipeNamespace, String dataPath) { updateCraftingRule(CarpetServer.settingsManager.getRule(ruleName),recipes,recipeNamespace,dataPath,ruleName); CarpetServer.settingsManager.addRuleObserver - ((source, rule, s) -> { - //#if MC>=11900 - //$$if (rule.name().equals(ruleName)) { - //$$ updateCraftingRule(rule, recipes, recipeNamespace, dataPath, ruleName); - //$$ reload(); - //$$} - //#else - if (rule.name.equals(ruleName)) { - updateCraftingRule(rule, recipes, recipeNamespace, dataPath, ruleName); - reload(); - } - //#endif - }); + ((source, rule, s) -> { + //#if MC>=11900 + //$$if (rule.name().equals(ruleName)) { + //$$ updateCraftingRule(rule, recipes, recipeNamespace, dataPath, ruleName); + //$$ reload(); + //$$} + //#else + if (rule.name.equals(ruleName)) { + updateCraftingRule(rule, recipes, recipeNamespace, dataPath, ruleName); + reload(); + } + //#endif + }); } private void updateCraftingRule( @@ -280,7 +267,7 @@ else if (rule.type == boolean.class && rule.getBoolValue()) { private void copyRecipes(String[] recipes, String recipeNamespace, String datapackPath, String ruleName) { for (String recipeName : recipes) { copyFile( - "assets/carpet-ams-addition/AmsRecipeTweakPack/" + recipeNamespace + "/recipes/" + recipeName, + "assets/carpetamsaddition/AmsRecipeTweakPack/" + recipeNamespace + "/recipes/" + recipeName, datapackPath + recipeNamespace + "/recipes/" + recipeName ); } @@ -310,7 +297,7 @@ private void deleteRecipes( private void writeAdvancement(String datapackPath, String ruleName, String[] recipes) { copyFile( - "assets/carpet-ams-addition/AmsRecipeTweakPack/ams/advancements/recipe_rule.json", + "assets/carpetamsaddition/AmsRecipeTweakPack/ams/advancements/recipe_rule.json", datapackPath + "ams/advancements/" + ruleName + ".json" ); @@ -355,39 +342,36 @@ private void copyFile(String resourcePath, String targetPath) { Logging.logStackTrace(e); } } - //#if MC>=11900 - private static JsonObject readJson(String filePath) { - try { - FileReader reader = new FileReader(filePath); - return JsonParser.parseReader(reader).getAsJsonObject(); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - return null; - } - //#else - //$$ private static JsonObject readJson(String filePath) { - //$$ JsonParser jsonParser = new JsonParser(); - //$$ try { - //$$ FileReader reader = new FileReader(filePath); - //$$ return jsonParser.parse(reader).getAsJsonObject(); - //$$ } catch (FileNotFoundException e) { - //$$ e.printStackTrace(); - //$$ } - //$$ return null; - //$$} - //#endif - - private static void writeJson(JsonObject jsonObject, String filePath) { - try { - FileWriter writer = new FileWriter(filePath); - writer.write(new GsonBuilder().setPrettyPrinting().create().toJson(jsonObject)); - writer.close(); - } catch (IOException e) { - Logging.logStackTrace(e); - } + //#if MC>=11900 + private static JsonObject readJson(String filePath) { + try { + FileReader reader = new FileReader(filePath); + return JsonParser.parseReader(reader).getAsJsonObject(); + } catch (FileNotFoundException e) { + e.printStackTrace(); } + return null; } + //#else + //$$ private static JsonObject readJson(String filePath) { + //$$ JsonParser jsonParser = new JsonParser(); + //$$ try { + //$$ FileReader reader = new FileReader(filePath); + //$$ return jsonParser.parse(reader).getAsJsonObject(); + //$$ } catch (FileNotFoundException e) { + //$$ e.printStackTrace(); + //$$ } + //$$ return null; + //$$} + //#endif - - + private static void writeJson(JsonObject jsonObject, String filePath) { + try { + FileWriter writer = new FileWriter(filePath); + writer.write(new GsonBuilder().setPrettyPrinting().create().toJson(jsonObject)); + writer.close(); + } catch (IOException e) { + Logging.logStackTrace(e); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/mcams/carpet/AmsServerSettings.java b/src/main/java/club/mcams/carpet/AmsServerSettings.java index f36b2446..f17f5c3a 100644 --- a/src/main/java/club/mcams/carpet/AmsServerSettings.java +++ b/src/main/java/club/mcams/carpet/AmsServerSettings.java @@ -1,12 +1,8 @@ package club.mcams.carpet; import club.mcams.carpet.util.recipes.CraftingRule; +import club.mcams.carpet.settings.Rule; import static club.mcams.carpet.settings.AmsRuleCategory.*; -//#if MC<11900 -import carpet.settings.Rule; -//#else -//$$ import carpet.api.settings.Rule; -//#endif /** * Here is your example Settings class you can plug to use carpetmod /carpet settings command @@ -14,477 +10,174 @@ public class AmsServerSettings { - @Rule( - //#if MC<11900 - desc = "Enabling making super bows with both infinite and mending enchants", - category = {AMS, FEATURE} - //#else - //$$ categories = {AMS, FEATURE} - //#endif - ) + @Rule(categories = {AMS, FEATURE}) public static boolean superBow = false; - @Rule( - //#if MC<11900 - desc = "Make cactus accepts scheduled tick as random tick", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean scheduledRandomTickCactus = false; - @Rule( - //#if MC<11900 - desc = "Make bamboo accepts scheduled tick as random tick", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean scheduledRandomTickBamboo = false; - @Rule( - //#if MC<11900 - desc = "Make chorus flower accepts scheduled tick as random tick", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean scheduledRandomTickChorusFlower = false; - @Rule( - //#if MC<11900 - desc = "Make sugar cane accepts scheduled tick as random tick", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean scheduledRandomTickSugarCane = false; - @Rule( - //#if MC<11900 - desc = "Make stems accepts scheduled tick as random tick", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean scheduledRandomTickStem = false; - @Rule( - //#if MC<11900 - desc = "Make all plants accepts scheduled tick as random tick", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean scheduledRandomTickAllPlants = false; - @Rule( - //#if MC<11900 - desc = "Optimize dragon respawning", - category = {AMS, OPTIMIZATION} - //#else - //$$ categories = {AMS, OPTIMIZATION} - //#endif - ) + @Rule(categories = {AMS, OPTIMIZATION}) public static boolean optimizedDragonRespawn = false; - @Rule( - options = {"bone_block", "wither_skeleton_skull", "note_block", "OFF"}, - //#if MC<11900 - desc = "Load nearby 3x3 chunks for 15 seconds when a note block is triggered", - extra = { - "[bone_block] - When bone_block is on the note_block", - "[wither_skeleton_skull] - When wither_skeleton_skull is on the note_block, either placed on the note block or hanging on the wall", - "[note_block] - Only note_block", - "[OFF] - Disable the rule" - }, - category = {AMS, FEATURE, AMS_CHUNKLOADER} - //#else - //$$ categories = {AMS, FEATURE, AMS_CHUNKLOADER} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_CHUNKLOADER}) public static String noteBlockChunkLoader = "OFF"; - @Rule( - options = {"bone_block", "bedrock", "all", "OFF"}, - //#if MC<11900 - desc = "Load nearby 3x3 chunks for 15 seconds when a piston is triggered", - extra = { - "[bone_block] - When bone_block is on the piston", - "[bedrock] - When bedrock is under the piston", - "[all] - When boe_block is on the piston or bed rock is under the piston", - "[OFF] - Disable the rule" - }, - category = {AMS, FEATURE, AMS_CHUNKLOADER} - //#else - //$$ categories = {AMS, FEATURE, AMS_CHUNKLOADER} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_CHUNKLOADER}) public static String pistonBlockChunkLoader = "OFF"; - @Rule( - //#if MC<11900 - desc = "Load nearby 3x3 chunks for 15 seconds when a bell is triggered", - category = {AMS, FEATURE, AMS_CHUNKLOADER} - //#else - //$$ categories = {AMS, FEATURE, AMS_CHUNKLOADER} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_CHUNKLOADER}) public static boolean bellBlockChunkLoader = false; - @Rule( - //#if MC<11900 - desc = "Control chunk loading for players at any gamemodes", - category = {AMS, COMMAND, AMS_CHUNKLOADER} - //#else - //$$ categories = {AMS, FEATURE, AMS_CHUNKLOADER} - //#endif - ) + @Rule(categories = {AMS, COMMAND, AMS_CHUNKLOADER}) public static String commandChunkLoading = "false"; - @Rule( - //#if MC<11900 - desc = "Players can use water buckets to place water in nether", - category = {AMS, FEATURE} - //#else - //$$ categories = {AMS, FEATURE} - //#endif - ) + @Rule(categories = {AMS, FEATURE}) public static boolean netherWaterPlacement = false; - //#if MC>=11700 - @Rule( - //#if MC<11900 - desc = "Change the hardness of deepslate to stone", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean softDeepslate = false; - //#endif - @Rule( - //#if MC<11900 - desc = "Change the hardness of obsdian to deepslate", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean softObsidian = false; - @Rule( - //#if MC<11900 - desc = "Set all blocks BlastResistance to 0", - category = {AMS, FEATURE, SURVIVAL, TNT} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL, TNT} - //#endif - ) + @Rule(categories = {AMS, FEATURE, TNT}) public static boolean blowUpEverything = false; - @Rule( - //#if MC<11900 - desc = "Share villagers discount to all players", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean sharedVillagerDiscounts = false; - @Rule( - //#if MC<11900 - desc = "Simulation fake Peace", - category = {AMS, FEATURE} - //#else - //$$ categories = {AMS, FEATURE} - //#endif - ) + @Rule(categories = {AMS, FEATURE}) public static boolean fakePeace = false; - @Rule( - //#if MC<11900 - desc = "The campfire is extinguished when the player places it", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean extinguishedCampfire = false; - @Rule( - //#if MC<11900 - desc = "players don't get hurt by flying into walls", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean safeFlight = false; //#if MC<11900 - @Rule( - desc = "Let the bone_block be update suppressor", - category = {AMS, FEATURE} - ) + @Rule(categories = {AMS, FEATURE}) public static boolean boneBlockUpdateSuppressor = false; //#endif - @Rule( - //#if MC<11900 - desc = "Explosion can destroy obsidian", - category = {AMS, FEATURE, SURVIVAL, TNT} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL, TNT} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL, TNT}) public static boolean weakObsidian = false; - @Rule( - //#if MC<11900 - desc = "Explosion can destroy crying_obsidian", - category = {AMS, FEATURE, SURVIVAL, TNT} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL, TNT} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL, TNT}) public static boolean weakCryingObsidian = false; - //#if MC>11800 - //$$ @Rule(categories = {AMS, FEATURE, SURVIVAL, TNT}) - //$$ public static boolean weakReinforcedDeepslate = false; + //#if MC>=11900 + @SuppressWarnings("unused") + @Rule(categories = {AMS, FEATURE, SURVIVAL, TNT}) + public static boolean weakReinforcedDeepslate = false; //#endif - @Rule( - //#if MC<11900 - desc = "Explosion can destroy bedrock", - category = {AMS, FEATURE, SURVIVAL, TNT} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL, TNT} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL, TNT}) public static boolean weakBedRock = false; - @Rule( - //#if MC<11900 - desc = "Explosion can destroy all blocks except anvil and bedrock", - category = {AMS, FEATURE, SURVIVAL, TNT} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL, TNT} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL, TNT}) public static boolean enhancedWorldEater = false; - @Rule( - //#if MC<11900 - desc = "This rule prevents villager trades from locking up", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean infiniteTrades = false; - @Rule( - //#if MC<11900 - desc = "Players will be invulnerable", - category = {AMS, FEATURE} - //#else - //$$ categories = {AMS, FEATURE} - //#endif - ) + @Rule(categories = {AMS, FEATURE}) public static boolean invulnerable = false; - @Rule( - //#if MC<11900 - desc = "Allows players in Creative mode to kill entities in one hit\n" + - "If the player is sneaking, other entities around the target get killed too", - category = {AMS, FEATURE, CREATIVE} - //#else - //$$ categories = {AMS, FEATURE, CREATIVE} - //#endif - ) + @Rule(categories = {AMS, FEATURE, CREATIVE}) public static boolean creativeOneHitKill = false; - @Rule( - //#if MC<11900 - desc = "Doubles the size of your EnderChest", - category = {AMS, FEATURE, SURVIVAL} - //#else - //$$ categories = {AMS, FEATURE, SURVIVAL} - //#endif - ) + @Rule(categories = {AMS, FEATURE, SURVIVAL}) public static boolean largeEnderChest = false; - @Rule( - //#if MC<11900 - desc = "The block model of bamboo will not generate offset", - category = {AMS, FEATURE, OPTIMIZATION} - //#else - //$$ categories = {AMS, FEATURE, OPTIMIZATION} - //#endif - ) + @Rule(categories = {AMS, FEATURE, OPTIMIZATION}) public static boolean bambooModelNoOffset = false; - @Rule( - //#if MC<11900 - desc = "Allow players to pass through bamboo", - category = {AMS, FEATURE} - //#else - //$$ categories = {AMS, FEATURE} - //#endif - ) + @Rule(categories = {AMS, FEATURE}) public static boolean bambooCollisionBoxDisabled = false; - @Rule( - //#if MC<11900 - desc = "Disable campfire smoke particles", - category = {AMS, FEATURE} - //#else - //$$ categories = {AMS, FEATURE} - //#endif - ) + @Rule(categories = {AMS, FEATURE}) public static boolean campfireSmokeParticleDisabled = false; - @Rule( - //#if MC<11900 - desc = "Totem will not be destroyed by flames and magma", - category = {AMS, FEATURE} - //#else - //$$ categories = {AMS, FEATURE} - //#endif - ) + @Rule(categories = {AMS, FEATURE}) public static boolean antiFireTotem = false; - @Rule( - //#if MC<11900 - desc = "Dropped items will not be destroyed by explosions", - category = {AMS, FEATURE, TNT} - //#else - //$$ categories = {AMS, FEATURE, TNT} - //#endif - ) + @Rule(categories = {AMS, FEATURE, TNT}) public static boolean itemAntiExplosion = false; - @Rule( - //#if MC<11900 - desc = "Breaking a shulker box with items in creative mode will not cause drops.", - category = {AMS, FEATURE, CREATIVE} - //#else - //$$ categories = {AMS, FEATURE, CREATIVE} - //#endif - ) + @Rule(categories = {AMS, FEATURE, CREATIVE}) public static boolean creativeShulkerBoxDropsDisable = false; /** * 可移动方块规则 */ - @Rule( - //#if MC<11900 - desc = "Makes ender_chests movable", - category = {AMS, FEATURE, AMS_MOVABLE} - //#else - //$$ categories = {AMS, FEATURE, AMS_MOVABLE} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) public static boolean movableEnderChest = false; - @Rule( - //#if MC<11900 - desc = "Makes end_portal_frame movable", - category = {AMS, FEATURE, AMS_MOVABLE} - //#else - //$$ categories = {AMS, FEATURE, AMS_MOVABLE} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) public static boolean movableEndPortalFrame = false; - @Rule( - //#if MC<11900 - desc = "Makes obsidian movable", - category = {AMS, FEATURE, AMS_MOVABLE} - //#else - //$$ categories = {AMS, FEATURE, AMS_MOVABLE} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) public static boolean movableObsidian = false; - @Rule( - //#if MC<11900 - desc = "Makes crying_obsidian movable", - category = {AMS, FEATURE, AMS_MOVABLE} - //#else - //$$ categories = {AMS, FEATURE, AMS_MOVABLE} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) public static boolean movableCryingObsidian = false; - @Rule( - //#if MC<11900 - desc = "Makes bedrock movable", - category = {AMS, FEATURE, AMS_MOVABLE} - //#else - //$$ categories = {AMS, FEATURE, AMS_MOVABLE} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) public static boolean movableBedRock = false; - @Rule( - //#if MC<11900 - desc = "Makes enchanting_table movable", - category = {AMS, FEATURE, AMS_MOVABLE} - //#else - //$$ categories = {AMS, FEATURE, AMS_MOVABLE} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) public static boolean movableEnchantingTable = false; - @Rule( - //#if MC<11900 - desc = "Makes beacon movable", - category = {AMS, FEATURE, AMS_MOVABLE} - //#else - //$$ categories = {AMS, FEATURE, AMS_MOVABLE} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) public static boolean movableBeacon = false; //#if MC>=11900 - //$$ @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) - //$$ public static boolean movableReinforcedDeepslate = false; + @SuppressWarnings("unused") + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) + public static boolean movableReinforcedDeepslate = false; //#endif //#if MC>=11900 - //$$ @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) - //$$ public static boolean movableSculkCatalyst = false; + @SuppressWarnings("unused") + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) + public static boolean movableSculkCatalyst = false; //#endif //#if MC>=11900 - //$$ @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) - //$$ public static boolean movableSculkSensor = false; + @SuppressWarnings("unused") + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) + public static boolean movableSculkSensor = false; //#endif //#if MC>=11900 - //$$ @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) - //$$ public static boolean movableSculkShrieker = false; + @SuppressWarnings("unused") + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) + public static boolean movableSculkShrieker = false; + //#endif + + //#if MC>=12000 + @SuppressWarnings("unused") + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) + public static boolean movableCalibratedSculkSensor = false; //#endif - @Rule( - //#if MC<11900 - desc = "Makes anvil movable", - category = {AMS, FEATURE, AMS_MOVABLE} - //#else - //$$ categories = {AMS, FEATURE, AMS_MOVABLE} - //#endif - ) + @Rule(categories = {AMS, FEATURE, AMS_MOVABLE}) public static boolean movableAnvil = false; /** @@ -492,91 +185,42 @@ public class AmsServerSettings { */ @SuppressWarnings("unused") @CraftingRule(recipes = "enchanted_golden_apples.json") - @Rule( - //#if MC<11900 - desc = "Enchanted Golden Apples can be crafted with 8 Gold Blocks again", - category = {CRAFTING, SURVIVAL, AMS} - //#else - //$$ categories = {CRAFTING, SURVIVAL, AMS} - //#endif - ) + @Rule(categories = {AMS, CRAFTING, SURVIVAL}) public static boolean craftableEnchantedGoldenApples = false; //#if MC>=11700 @SuppressWarnings("unused") @CraftingRule(recipes = "bundle.json") - @Rule( - //#if MC<11900 - desc = "Crafted bundle in minecraft 1.17/1.18/1.19", - category = {CRAFTING, SURVIVAL, AMS} - //#else - //$$ categories = {CRAFTING, SURVIVAL, AMS} - //#endif - ) + @Rule(categories = {AMS, CRAFTING, SURVIVAL}) public static boolean craftableBundle = false; //#endif //#if MC<11900 && MC>=11700 @SuppressWarnings("unused") @CraftingRule(recipes = "sculk_sensor.json") - @Rule( - //#if MC<11900 - desc = "Crafted sculk_sensor in minecraft 1.17/1.18", - category = {CRAFTING, SURVIVAL, AMS} - //#else - //$$ categories = {CRAFTING, SURVIVAL, AMS} - //#endif - ) + @Rule(categories = {AMS, CRAFTING, SURVIVAL}) public static boolean craftableSculkSensor = false; //#endif @SuppressWarnings("unused") @CraftingRule(recipes = "bone_block.json") - @Rule( - //#if MC<11900 - desc = "Use nine bones to crafted three bone_blocks", - category = {CRAFTING, SURVIVAL, AMS} - //#else - //$$ categories = {CRAFTING, SURVIVAL, AMS} - //#endif - ) + @Rule(categories = {AMS, CRAFTING, SURVIVAL}) public static boolean betterCraftableBoneBlock = false; @SuppressWarnings("unused") @CraftingRule(recipes = "elytra.json") - @Rule( - //#if MC<11900 - desc = "Crafted elytra in minecraft", - category = {CRAFTING, SURVIVAL, AMS} - //#else - //$$ categories = {CRAFTING, SURVIVAL, AMS} - //#endif - ) + @Rule(categories = {AMS, CRAFTING, SURVIVAL}) public static boolean craftableElytra = false; @SuppressWarnings("unused") @CraftingRule(recipes = {"dispenser1.json", "dispenser2.json"}) - @Rule( - //#if MC<11900 - desc = "Better craftable dispenser", - category = {CRAFTING, SURVIVAL, AMS} - //#else - //$$ categories = {CRAFTING, SURVIVAL, AMS} - //#endif - ) + @Rule(categories = {AMS, CRAFTING, SURVIVAL}) public static boolean betterCraftableDispenser = false; //#if MC>=11700 @SuppressWarnings("unused") @CraftingRule(recipes = "polished_blackstone_button.json") - @Rule( - //#if MC<11900 - desc = "Use deepslate to crafted polished_blackstone_button in minecraft", - category = {CRAFTING, SURVIVAL, AMS} - //#else - //$$ categories = {CRAFTING, SURVIVAL, AMS} - //#endif - ) + @Rule(categories = {AMS, CRAFTING, SURVIVAL}) public static boolean betterCraftablePolishedBlackStoneButton = false; //#endif } diff --git a/src/main/java/club/mcams/carpet/mixin/carpet/SettingsManagerMixin.java b/src/main/java/club/mcams/carpet/mixin/carpet/SettingsManagerMixin.java index dd4a8e6b..75388dc9 100644 --- a/src/main/java/club/mcams/carpet/mixin/carpet/SettingsManagerMixin.java +++ b/src/main/java/club/mcams/carpet/mixin/carpet/SettingsManagerMixin.java @@ -37,7 +37,7 @@ public abstract class SettingsManagerMixin { ) private void printVersion(ServerCommandSource source, CallbackInfoReturnable cir) { Messenger.m(source, - String.format("g %s ", AmsServer.MOD_NAME), + String.format("g %s ", AmsServer.fancyName), String.format("g %s: ", tr("ui.version", "version")), String.format("g %s", AmsServerMod.getVersion()) ); diff --git a/src/main/java/club/mcams/carpet/mixin/rule/movableBlocks/PistonBlockMixin.java b/src/main/java/club/mcams/carpet/mixin/rule/movableBlocks/PistonBlockMixin.java index a2faac94..7aa3f4c7 100644 --- a/src/main/java/club/mcams/carpet/mixin/rule/movableBlocks/PistonBlockMixin.java +++ b/src/main/java/club/mcams/carpet/mixin/rule/movableBlocks/PistonBlockMixin.java @@ -23,7 +23,7 @@ public abstract class PistonBlockMixin { private static void MovableBlocks(BlockState state, World world, BlockPos pos, Direction direction, boolean canBreak, Direction pistonDir, CallbackInfoReturnable cir) { //#endif if ( - (AmsServerSettings.movableEnderChest && state.isOf(Blocks.ENDER_CHEST)) || + (AmsServerSettings.movableEnderChest && state.isOf(Blocks.ENDER_CHEST)) || (AmsServerSettings.movableEndPortalFrame && state.isOf(Blocks.END_PORTAL_FRAME)) || (AmsServerSettings.movableObsidian && state.isOf(Blocks.OBSIDIAN)) || (AmsServerSettings.movableCryingObsidian && state.isOf(Blocks.CRYING_OBSIDIAN)) || @@ -37,6 +37,9 @@ private static void MovableBlocks(BlockState state, World world, BlockPos pos, D //$$ || (AmsServerSettings.movableSculkSensor && state.isOf(Blocks.SCULK_SENSOR)) //$$ || (AmsServerSettings.movableSculkShrieker && state.isOf(Blocks.SCULK_SHRIEKER)) //#endif + //#if MC>=12000 + //$$ || (AmsServerSettings.movableCalibratedSculkSensor && state.isOf(Blocks.CALIBRATED_SCULK_SENSOR)) + //#endif ) { //#if MC<11700 //$$ if (direction == Direction.DOWN && blockPos.getY() == 0) { diff --git a/src/main/java/club/mcams/carpet/mixin/setting/ParsedRuleAccessor.java b/src/main/java/club/mcams/carpet/mixin/setting/ParsedRuleAccessor.java new file mode 100644 index 00000000..85262b4f --- /dev/null +++ b/src/main/java/club/mcams/carpet/mixin/setting/ParsedRuleAccessor.java @@ -0,0 +1,20 @@ +package club.mcams.carpet.mixin.setting; + +import carpet.settings.ParsedRule; +import carpet.settings.Rule; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +import java.lang.reflect.Field; + +@Mixin(ParsedRule.class) +public interface ParsedRuleAccessor { + //#if MC<=11900 + @SuppressWarnings("rawtypes") + @Invoker(value = "", remap = false) + static ParsedRule invokeConstructor(Field field, Rule rule, carpet.settings.SettingsManager settingsManager) { + throw new RuntimeException(); + } + //#endif +} diff --git a/src/main/java/club/mcams/carpet/mixin/setting/SettingsManagerAccessor.java b/src/main/java/club/mcams/carpet/mixin/setting/SettingsManagerAccessor.java new file mode 100644 index 00000000..97f4c129 --- /dev/null +++ b/src/main/java/club/mcams/carpet/mixin/setting/SettingsManagerAccessor.java @@ -0,0 +1,15 @@ +package club.mcams.carpet.mixin.setting; + +import carpet.settings.ParsedRule; +import carpet.settings.SettingsManager; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import java.util.Map; + +@Mixin(SettingsManager.class) +public interface SettingsManagerAccessor { + @Accessor(value = "rules", remap = false) + Map> getRules$AMS(); +} diff --git a/src/main/java/club/mcams/carpet/mixin/translations/ClientSettingsC2SPacketAccessor.java b/src/main/java/club/mcams/carpet/mixin/translations/ClientSettingsC2SPacketAccessor.java new file mode 100644 index 00000000..b882d671 --- /dev/null +++ b/src/main/java/club/mcams/carpet/mixin/translations/ClientSettingsC2SPacketAccessor.java @@ -0,0 +1,13 @@ +package club.mcams.carpet.mixin.translations; + +import net.minecraft.network.packet.c2s.play.ClientSettingsC2SPacket; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@SuppressWarnings("unused") +@Mixin(ClientSettingsC2SPacket.class) +public interface ClientSettingsC2SPacketAccessor { + @Accessor(value = "language") + String getLanguage$AMS(); +} \ No newline at end of file diff --git a/src/main/java/club/mcams/carpet/mixin/translations/HUDControllerMixin.java b/src/main/java/club/mcams/carpet/mixin/translations/HUDControllerMixin.java new file mode 100644 index 00000000..32a20828 --- /dev/null +++ b/src/main/java/club/mcams/carpet/mixin/translations/HUDControllerMixin.java @@ -0,0 +1,36 @@ +package club.mcams.carpet.mixin.translations; + +import carpet.logging.HUDController; + +import club.mcams.carpet.translations.AMSTranslations; + +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.text.BaseText; +//#if MC>=11900 +//$$ import net.minecraft.text.Text; +//#endif + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +@Mixin(HUDController.class) +public abstract class HUDControllerMixin { + //#if MC>=11900 + //$$ @ModifyVariable(method = "addMessage", at = @At("HEAD"), argsOnly = true, remap = false) + //$$ private static Text applyAMSTranslationToHudLoggerMessage(Text hudMessage, /* parent method parameters -> */ ServerPlayerEntity player, Text hudMessage_) { + //$$ if (player != null) { + //$$ hudMessage = AMSTranslations.translate((MutableText) hudMessage, player); + //$$ } + //$$ return hudMessage; + //$$ } + //#else + @ModifyVariable(method = "addMessage", at = @At("HEAD"), argsOnly = true, remap = false) + private static BaseText applyAMSTranslationToHudLoggerMessage(BaseText hudMessage, /* parent method parameters -> */ ServerPlayerEntity player, BaseText hudMessage_) { + if (player != null) { + hudMessage = AMSTranslations.translate(hudMessage, player); + } + return hudMessage; + } + //#endif +} diff --git a/src/main/java/club/mcams/carpet/mixin/translations/LoggerMixin.java b/src/main/java/club/mcams/carpet/mixin/translations/LoggerMixin.java new file mode 100644 index 00000000..ad383a66 --- /dev/null +++ b/src/main/java/club/mcams/carpet/mixin/translations/LoggerMixin.java @@ -0,0 +1,37 @@ +package club.mcams.carpet.mixin.translations; + +import carpet.logging.Logger; + +import club.mcams.carpet.translations.AMSTranslations; + +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.text.BaseText; +//#if MC>=11900 +//$$ import net.minecraft.text.MutableText; +//$$ import net.minecraft.text.Text; +//#endif + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +@Mixin(Logger.class) +public abstract class LoggerMixin { + //#if MC>=11900 + //$$ @ModifyVariable(method = "sendPlayerMessage", at = @At("HEAD"), argsOnly = true, remap = false) + //$$ private Text[] applyAMSTranslationToLoggerMessage(Text[] messages, /* parent method parameters -> */ ServerPlayerEntity player, Text... messages_) { + //$$ for (int i = 0; i < messages.length; i++) { + //$$ messages[i] = AMSTranslations.translate((MutableText) messages[i], player); + //$$ } + //$$ return messages; + //$$ } + //#else + @ModifyVariable(method = "sendPlayerMessage", at = @At("HEAD"), argsOnly = true, remap = false) + private BaseText[] applyAMSTranslationToLoggerMessage(BaseText[] messages, /* parent method parameters -> */ ServerPlayerEntity player, BaseText... messages_) { + for (int i = 0; i < messages.length; i++) { + messages[i] = AMSTranslations.translate(messages[i], player); + } + return messages; + } + //#endif +} diff --git a/src/main/java/club/mcams/carpet/mixin/translations/ServerPlayerEntityMixin.java b/src/main/java/club/mcams/carpet/mixin/translations/ServerPlayerEntityMixin.java new file mode 100644 index 00000000..22502b45 --- /dev/null +++ b/src/main/java/club/mcams/carpet/mixin/translations/ServerPlayerEntityMixin.java @@ -0,0 +1,33 @@ +package club.mcams.carpet.mixin.translations; + +import club.mcams.carpet.translations.ServerPlayerEntityWithClientLanguage; + +import net.minecraft.network.packet.c2s.play.ClientSettingsC2SPacket; +import net.minecraft.server.network.ServerPlayerEntity; + +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; + +@Mixin(ServerPlayerEntity.class) +public class ServerPlayerEntityMixin implements ServerPlayerEntityWithClientLanguage { + private String clientLanguage$AMS = "en_US"; + + //#if MC>=11800 + @Inject(method = "setClientSettings", at = @At("HEAD")) + private void recordClientLanguage(ClientSettingsC2SPacket packet, CallbackInfo ci) { + this.clientLanguage$AMS = packet.language(); + } + //#else + //$$ @Inject(method = "setClientSettings", at = @At("HEAD")) + //$$ private void recordClientLanguage(ClientSettingsC2SPacket packet, CallbackInfo ci) { + //$$ this.clientLanguage$AMS = ((ClientSettingsC2SPacketAccessor) packet).getLanguage$AMS(); + //$$ } + //#endif + + @Override + public String getClientLanguage$AMS() { + return this.clientLanguage$AMS; + } +} diff --git a/src/main/java/club/mcams/carpet/mixin/translations/StyleAccessor.java b/src/main/java/club/mcams/carpet/mixin/translations/StyleAccessor.java new file mode 100644 index 00000000..96b621cb --- /dev/null +++ b/src/main/java/club/mcams/carpet/mixin/translations/StyleAccessor.java @@ -0,0 +1,45 @@ +package club.mcams.carpet.mixin.translations; + +import net.minecraft.text.HoverEvent; +import net.minecraft.text.Style; +import net.minecraft.text.TextColor; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(Style.class) +public interface StyleAccessor { + @Accessor("bold") + Boolean getBoldField(); + + @Accessor("italic") + Boolean getItalicField(); + + @Accessor("underlined") + Boolean getUnderlineField(); + + @Mutable + @Accessor("underlined") + void setUnderlinedField(Boolean value); + + @Accessor("strikethrough") + Boolean getStrikethroughField(); + + @Mutable + @Accessor("strikethrough") + void setStrikethroughField(Boolean value); + + @Accessor("obfuscated") + Boolean getObfuscatedField(); + + @Mutable + @Accessor("obfuscated") + void setObfuscatedField(Boolean value); + + @Accessor("color") + TextColor getColorField(); + + @Accessor("hoverEvent") + HoverEvent getHoverEventField(); +} diff --git a/src/main/java/club/mcams/carpet/mixin/translations/TranslatableTextAccessor.java b/src/main/java/club/mcams/carpet/mixin/translations/TranslatableTextAccessor.java new file mode 100644 index 00000000..d2102a59 --- /dev/null +++ b/src/main/java/club/mcams/carpet/mixin/translations/TranslatableTextAccessor.java @@ -0,0 +1,31 @@ +package club.mcams.carpet.mixin.translations; + +import net.minecraft.text.StringVisitable; +import net.minecraft.text.TranslatableText; +//#if MC<11800 +//$$ import net.minecraft.text.Text; +//#endif + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; +//#if MC<11800 +//$$ import org.spongepowered.asm.mixin.gen.Accessor; +//#endif + +//#if MC<11800 +//$$ import java.util.List; +//#endif +import java.util.function.Consumer; + +@Mixin(TranslatableText.class) +public interface TranslatableTextAccessor { + //#if MC>=11800 + @Invoker + void invokeForEachPart(String translation, Consumer partsConsumer); + //#else + //$$ @Accessor + //$$ List getTranslations(); + //$$ @Invoker + //$$ void invokeSetTranslation(String translation); + //#endif +} diff --git a/src/main/java/club/mcams/carpet/mixin/translations/TranslatableTextMixin.java b/src/main/java/club/mcams/carpet/mixin/translations/TranslatableTextMixin.java new file mode 100644 index 00000000..776564f1 --- /dev/null +++ b/src/main/java/club/mcams/carpet/mixin/translations/TranslatableTextMixin.java @@ -0,0 +1,43 @@ +package club.mcams.carpet.mixin.translations; + +import club.mcams.carpet.translations.AMSTranslations; +import club.mcams.carpet.translations.TranslationConstants; + +import net.minecraft.text.TranslatableText; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +/** + * From Carpet TIS Addition + */ +@Mixin(TranslatableText.class) +public abstract class TranslatableTextMixin { + @Shadow + @Final + private String key; + + @ModifyArg( + method = "updateTranslations", + at = @At( + value = "INVOKE", + //#if MC<11800 + //$$ target = "Lnet/minecraft/text/TranslatableText;setTranslation(Ljava/lang/String;)V" + //#else + target = "Lnet/minecraft/text/TranslatableText;forEachPart(Ljava/lang/String;Ljava/util/function/Consumer;)V" + //#endif + ) + ) + private String applyAMSTranslation(String vanillaTranslatedFormattingString) { + if (this.key.startsWith(TranslationConstants.TRANSLATION_KEY_PREFIX) && vanillaTranslatedFormattingString.equals(this.key)) { + String amsTranslated = AMSTranslations.translateKeyToFormattedString(AMSTranslations.getServerLanguage(), this.key); + if (amsTranslated != null) { + return amsTranslated; + } + } + return vanillaTranslatedFormattingString; + } +} diff --git a/src/main/java/club/mcams/carpet/settings/CarpetRuleRegistrar.java b/src/main/java/club/mcams/carpet/settings/CarpetRuleRegistrar.java new file mode 100644 index 00000000..d1c67a22 --- /dev/null +++ b/src/main/java/club/mcams/carpet/settings/CarpetRuleRegistrar.java @@ -0,0 +1,171 @@ +package club.mcams.carpet.settings; + +import carpet.settings.ParsedRule; +import carpet.settings.SettingsManager; +import carpet.settings.Validator; + +import club.mcams.carpet.AmsServer; +import club.mcams.carpet.mixin.setting.ParsedRuleAccessor; +import club.mcams.carpet.mixin.setting.SettingsManagerAccessor; +import club.mcams.carpet.translations.AMSTranslations; +import club.mcams.carpet.translations.TranslationConstants; + +import com.google.common.collect.Lists; + +import org.jetbrains.annotations.Nullable; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +//#if MC>=11900 +//$$ import java.lang.reflect.Constructor; +//$$ import java.lang.reflect.InvocationTargetException; +//$$ import java.util.Arrays; +//#endif +import java.util.List; + +public class CarpetRuleRegistrar { + private final SettingsManager settingsManager; + private final List> rules = Lists.newArrayList(); + + private CarpetRuleRegistrar(SettingsManager settingsManager) { + this.settingsManager = settingsManager; + } + + public static void register(SettingsManager settingsManager, Class settingsClass) { + CarpetRuleRegistrar registrar = new CarpetRuleRegistrar(settingsManager); + registrar.parseSettingsClass(settingsClass); + registrar.registerToCarpet(); + } + + public void parseSettingsClass(Class settingsClass) { + for (Field field : settingsClass.getDeclaredFields()) { + Rule rule = field.getAnnotation(Rule.class); + if (rule != null) { + this.parseRule(field, rule); + } + } + } + + //#if MC>=11900 + //$$ private void parseRule(Field field, Rule rule) { + //$$ try { + //$$ Class ruleAnnotationClass = Class.forName("carpet.settings.ParsedRule$RuleAnnotation"); + //$$ Constructor ctr1 = ruleAnnotationClass.getDeclaredConstructors()[0]; + //$$ ctr1.setAccessible(true); + //$$ Object ruleAnnotation = ctr1.newInstance(false, null, null, null, rule.categories(), rule.options(), rule.strict(), "", rule.validators()); + //$$ Class parsedRuleClass = Class.forName("carpet.settings.ParsedRule"); + //$$ Constructor ctr2 = Arrays.stream(parsedRuleClass.getDeclaredConstructors()).filter(ctr -> { + //$$ Class[] parameterTypes = ctr.getParameterTypes(); + //$$ if (parameterTypes.length != 3) return false; + //$$ return parameterTypes[0] == Field.class && parameterTypes[1] == ruleAnnotationClass && parameterTypes[2] == SettingsManager.class; + //$$ }).findFirst().orElseThrow(() -> new RuntimeException("Failed to get matched ParsedRule constructor")); + //$$ ctr2.setAccessible(true); + //$$ Object carpetRule = ctr2.newInstance(field, ruleAnnotation, this.settingsManager); + //$$ this.rules.add((CarpetRule) carpetRule); + //$$ } catch (InvocationTargetException e) { + //$$ throw new RuntimeException(e.getTargetException()); + //$$ } catch (Exception e) { + //$$ throw new RuntimeException(e); + //$$ } + //$$ } + //#else + @SuppressWarnings("rawtypes") + private void parseRule(Field field, Rule rule) { + carpet.settings.Rule cmRule = new carpet.settings.Rule() { + private final String basedKey = TranslationConstants.CARPET_TRANSLATIONS_KEY_PREFIX + "rule." + this.name() + "."; + + @Nullable + private String tr(String key) { + return AMSTranslations.translateKeyToFormattedString(TranslationConstants.DEFAULT_LANGUAGE, this.basedKey + key); + } + + @Override + public String desc() { + String desc = this.tr("desc"); + if (desc == null) { + throw new NullPointerException(String.format("Rule %s has no translated desc", this.name())); + } + return desc; + } + + @Override + public String[] extra() { + List extraMessages = Lists.newArrayList(); + for (int i = 0; ; i++) { + String message = this.tr("extra." + i); + if (message == null) { + break; + } + extraMessages.add(message); + } + return extraMessages.toArray(new String[0]); + } + + @Override + public String name() { + return field.getName(); + } + + @Override + public String[] category() { + return rule.categories(); + } + + @Override + public String[] options() { + return rule.options(); + } + + @Override + public boolean strict() { + return rule.strict(); + } + + @Override + public Class[] validate() { + return rule.validators(); + } + + @Override + public Class annotationType() { + return rule.annotationType(); + } + + @Override + public String appSource() { + return ""; + } + + @SuppressWarnings("unchecked") + @Override + public Class[] condition() { + return new Class[0]; + } + }; + + ParsedRule parsedRule = ParsedRuleAccessor.invokeConstructor( + field, cmRule, this.settingsManager + ); + this.rules.add(parsedRule); + } + //#endif + + public void registerToCarpet() { + //#if MC>=11900 + //$$ for (CarpetRule rule : this.rules) { + //$$ try { + //$$ this.settingsManager.addCarpetRule(rule); + //$$ } catch (UnsupportedOperationException e) { + //$$ AmsServer.LOGGER.warn("Failed to register rule {} to fabric carpet: {}", rule.name(), e); + //$$ } + //$$ } + //#else + for (ParsedRule rule : this.rules) { + Object existingRule = ((SettingsManagerAccessor) this.settingsManager).getRules$AMS().put(rule.name, rule); + if (existingRule != null) { + AmsServer.LOGGER.warn("Overwriting existing rule {}", existingRule); + } + } + //#endif + } +} diff --git a/src/main/java/club/mcams/carpet/settings/Rule.java b/src/main/java/club/mcams/carpet/settings/Rule.java new file mode 100644 index 00000000..f63bb424 --- /dev/null +++ b/src/main/java/club/mcams/carpet/settings/Rule.java @@ -0,0 +1,21 @@ +package club.mcams.carpet.settings; + +import carpet.settings.Validator; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Rule +{ + String[] categories(); + + String[] options() default {}; + + boolean strict() default true; + + Class[] validators() default {}; +} diff --git a/src/main/java/club/mcams/carpet/settings/RuleObserver.java b/src/main/java/club/mcams/carpet/settings/RuleObserver.java new file mode 100644 index 00000000..e78583ce --- /dev/null +++ b/src/main/java/club/mcams/carpet/settings/RuleObserver.java @@ -0,0 +1,19 @@ +package club.mcams.carpet.settings; + + +import carpet.settings.ParsedRule; +import carpet.settings.Validator; + +import net.minecraft.server.command.ServerCommandSource; + +public abstract class RuleObserver extends Validator { + @Override + public T validate(ServerCommandSource source, ParsedRule currentRule, T newValue, String string) { + if (currentRule.get() != newValue) { + this.onValueChanged(currentRule.get(), newValue); + } + return newValue; + } + + abstract public void onValueChanged(T oldValue, T newValue); +} diff --git a/src/main/java/club/mcams/carpet/translations/AMSTranslations.java b/src/main/java/club/mcams/carpet/translations/AMSTranslations.java new file mode 100644 index 00000000..22335534 --- /dev/null +++ b/src/main/java/club/mcams/carpet/translations/AMSTranslations.java @@ -0,0 +1,171 @@ +package club.mcams.carpet.translations; + +import carpet.CarpetSettings; + +import club.mcams.carpet.util.Messenger; +import club.mcams.carpet.AmsServer; +import club.mcams.carpet.mixin.translations.StyleAccessor; +import club.mcams.carpet.mixin.translations.TranslatableTextAccessor; +import club.mcams.carpet.util.FileUtil; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.text.*; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.yaml.snakeyaml.Yaml; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Reference: Carpet TIS Addition + */ +public class AMSTranslations { + private static final String LANG_DIR = String.format("assets/%s/lang", TranslationConstants.TRANSLATION_NAMESPACE); + + public static final Map> translations = Maps.newLinkedHashMap(); + public static final Set languages = Sets.newHashSet(); + + @SuppressWarnings("unchecked") + private static List getAvailableTranslations() { + try { + String dataStr = FileUtil.readFile(LANG_DIR + "/meta/languages.yml"); + Map yamlMap = new Yaml().load(dataStr); + return (List) yamlMap.get("languages"); + } catch (Exception e) { + AmsServer.LOGGER.warn("Failed to load translations"); + return Lists.newArrayList(); + } + } + + public static void loadTranslations() { + getAvailableTranslations().forEach(AMSTranslations::loadTranslation); + } + + public static void loadTranslation(String language) { + String path = String.format("%s/%s.yml", LANG_DIR, language); + String data; + try { + data = FileUtil.readFile(path); + } catch (IOException e) { + AmsServer.LOGGER.warn("Failed to load translation: " + language); + return; + } + Map yaml = new Yaml().load(data); + Map translation = Maps.newLinkedHashMap(); + build(translation, yaml, ""); + translations.put(language, translation); + languages.add(language); + } + + @SuppressWarnings("unchecked") + public static void build(Map translation, Map yaml, String prefix) { + yaml.forEach((key, value) -> { + String fullKey = prefix.isEmpty() ? key : (!key.equals(".") ? prefix + "." + key : prefix); + if (value instanceof String) { + translation.put(fullKey, (String) value); + } else if (value instanceof Map) { + build(translation, (Map) value, fullKey); + } else { + throw new RuntimeException(String.format("Unknown type %s in with key %s", value.getClass(), fullKey)); + } + }); + } + + public static String getServerLanguage() { + return CarpetSettings.language.equalsIgnoreCase("none") ? TranslationConstants.DEFAULT_LANGUAGE : CarpetSettings.language; + } + + @NotNull + public static Map getTranslation(String lang) { + return translations.getOrDefault(lang, Collections.emptyMap()); + } + + @Nullable + public static String translateKeyToFormattedString(String lang, String key) { + return getTranslation(lang.toLowerCase()).get(key); + } + + public static BaseText translate(BaseText text, ServerPlayerEntity player) { + return translate(text, ((ServerPlayerEntityWithClientLanguage) player).getClientLanguage$AMS().toLowerCase()); + } + + public static BaseText translate(BaseText text) { + return translate(text, getServerLanguage()); + } + + public static BaseText translate(BaseText text, String lang) { + return translate(text, lang, false); + } + + public static BaseText translate(BaseText text, String lang, boolean suppressWarnings) { + //#if MC>=11900 + //$$ if (text.getContent() instanceof TranslatableTextContent) { + //#else + if (text instanceof TranslatableText) { + //#endif + //#if MC>=11900 + //$$ TranslatableTextContent translatableText = (TranslatableTextContent) text.getContent(); + //#else + TranslatableText translatableText = (TranslatableText) text; + //#endif + if (translatableText.getKey().startsWith(TranslationConstants.TRANSLATION_KEY_PREFIX)) { + String formattedString = translateKeyToFormattedString(lang, translatableText.getKey()); + if (formattedString == null) { + // not supported language + formattedString = translateKeyToFormattedString(TranslationConstants.DEFAULT_LANGUAGE, translatableText.getKey()); + } + if (formattedString != null) { + BaseText origin = text; + //#if MC>=11900 + //$$ TranslatableTextAccessor fixedTranslatableText = (TranslatableTextAccessor) (Messenger.tr(formattedString, translatableText.getArgs())).getContent(); + //#else + TranslatableTextAccessor fixedTranslatableText = (TranslatableTextAccessor) (new TranslatableText(formattedString, translatableText.getArgs())); + //#endif + try { + List translations = Lists.newArrayList(); + //#if MC>=11800 + fixedTranslatableText.invokeForEachPart(formattedString, translations::add); + //#else + //$$ fixedTranslatableText.invokeSetTranslation(formattedString); + //#endif + text = Messenger.c(translations.stream().map(stringVisitable -> { + if (stringVisitable instanceof BaseText) { + return (BaseText) stringVisitable; + } + return Messenger.s(stringVisitable.getString()); + }).toArray()); + } catch (TranslationException e) { + text = Messenger.s(formattedString); + } + text.getSiblings().addAll(origin.getSiblings()); + text.setStyle(origin.getStyle()); + } else if (!suppressWarnings) { + AmsServer.LOGGER.warn("Unknown translation key {}", translatableText.getKey()); + } + } + } + + // translate hover text + HoverEvent hoverEvent = ((StyleAccessor) text.getStyle()).getHoverEventField(); + if (hoverEvent != null) { + Object hoverText = hoverEvent.getValue(hoverEvent.getAction()); + if (hoverEvent.getAction() == HoverEvent.Action.SHOW_TEXT && hoverText instanceof BaseText) { + text.setStyle(text.getStyle().withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, translate((BaseText) hoverText, lang)))); + } + } + + // translate sibling texts + List siblings = text.getSiblings(); + siblings.replaceAll(text1 -> translate((BaseText) text1, lang)); + return text; + } +} diff --git a/src/main/java/club/mcams/carpet/translations/ServerPlayerEntityWithClientLanguage.java b/src/main/java/club/mcams/carpet/translations/ServerPlayerEntityWithClientLanguage.java new file mode 100644 index 00000000..f11615d3 --- /dev/null +++ b/src/main/java/club/mcams/carpet/translations/ServerPlayerEntityWithClientLanguage.java @@ -0,0 +1,5 @@ +package club.mcams.carpet.translations; + +public interface ServerPlayerEntityWithClientLanguage { + String getClientLanguage$AMS(); +} diff --git a/src/main/java/club/mcams/carpet/translations/TranslationConstants.java b/src/main/java/club/mcams/carpet/translations/TranslationConstants.java new file mode 100644 index 00000000..c9109f54 --- /dev/null +++ b/src/main/java/club/mcams/carpet/translations/TranslationConstants.java @@ -0,0 +1,10 @@ +package club.mcams.carpet.translations; + +import club.mcams.carpet.AmsServer; + +public class TranslationConstants { + public static final String DEFAULT_LANGUAGE = "en_us"; + public static final String TRANSLATION_NAMESPACE = AmsServer.compactName; // "amscarpetaddition" + public static final String TRANSLATION_KEY_PREFIX = TRANSLATION_NAMESPACE + "."; // "amscarpetaddition." + public static final String CARPET_TRANSLATIONS_KEY_PREFIX = TRANSLATION_KEY_PREFIX + "carpet_translations."; // "amscarpetaddition.carpet_translations." +} diff --git a/src/main/java/club/mcams/carpet/translations/TranslationContext.java b/src/main/java/club/mcams/carpet/translations/TranslationContext.java new file mode 100644 index 00000000..13829496 --- /dev/null +++ b/src/main/java/club/mcams/carpet/translations/TranslationContext.java @@ -0,0 +1,23 @@ +package club.mcams.carpet.translations; + +import net.minecraft.text.BaseText; + +public class TranslationContext { + private final Translator translator; + + protected TranslationContext(Translator translator) { + this.translator = translator; + } + + protected TranslationContext(String translationPath) { + this(new Translator(translationPath)); + } + + public Translator getTranslator() { + return translator; + } + + protected BaseText tr(String key, Object... args) { + return this.translator.tr(key, args); + } +} diff --git a/src/main/java/club/mcams/carpet/translations/Translator.java b/src/main/java/club/mcams/carpet/translations/Translator.java new file mode 100644 index 00000000..929d36ad --- /dev/null +++ b/src/main/java/club/mcams/carpet/translations/Translator.java @@ -0,0 +1,21 @@ +package club.mcams.carpet.translations; + +import club.mcams.carpet.util.Messenger; +import net.minecraft.text.BaseText; + +public class Translator { + private final String translationPath; + + public Translator getDerivedTranslator(String derivedName) { + return new Translator(this.translationPath + "." + derivedName); + } + + public Translator(String translationPath) { + this.translationPath = translationPath; + } + + public BaseText tr(String key, Object... args) { + String translationKey = TranslationConstants.TRANSLATION_KEY_PREFIX + this.translationPath + "." + key; + return Messenger.tr(translationKey, args); + } +} diff --git a/src/main/java/club/mcams/carpet/util/AmsCarpetTranslations.java b/src/main/java/club/mcams/carpet/util/AmsCarpetTranslations.java deleted file mode 100644 index 042780a4..00000000 --- a/src/main/java/club/mcams/carpet/util/AmsCarpetTranslations.java +++ /dev/null @@ -1,36 +0,0 @@ -package club.mcams.carpet.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.Collections; -import java.util.Map; - -import org.apache.commons.io.IOUtils; - -public class AmsCarpetTranslations { - public static Map getTranslationFromResourcePath(String lang) { - //#if MC<=11800 - InputStream langFile = AmsCarpetTranslations.class.getClassLoader().getResourceAsStream("assets/carpet-ams-addition/lang/%s.json".formatted(lang)); - //#else - //$$ InputStream langFile = AmsCarpetTranslations.class.getClassLoader().getResourceAsStream("assets/carpet-ams-addition/lang_1.19+/%s.json".formatted(lang)); - //#endif - if (langFile == null) { - // we don't have that language - return Collections.emptyMap(); - } - String jsonData; - try { - jsonData = IOUtils.toString(langFile, StandardCharsets.UTF_8); - } catch (IOException e) { - return Collections.emptyMap(); - } - Gson gson = new GsonBuilder().setLenient().create(); // lenient allows for comments - return gson.fromJson(jsonData, new TypeToken>() { - }.getType()); - } -} diff --git a/src/main/java/club/mcams/carpet/util/FileUtil.java b/src/main/java/club/mcams/carpet/util/FileUtil.java new file mode 100644 index 00000000..0137f24a --- /dev/null +++ b/src/main/java/club/mcams/carpet/util/FileUtil.java @@ -0,0 +1,38 @@ +package club.mcams.carpet.util; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; + +public class FileUtil { + public static String readFile(String path) throws IOException { + InputStream inputStream = FileUtil.class.getClassLoader().getResourceAsStream(path); + if (inputStream == null) { + throw new IOException("Null input stream from path " + path); + } + return IOUtils.toString(inputStream, StandardCharsets.UTF_8); + } + + public static void writeToFile(Path path, String text) throws IOException { + if (!Files.exists(path.getParent())) { + Files.createDirectories(path.getParent()); + } + try (BufferedWriter writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) { + writer.write(text); + } + } + + public static String getFileExtension(String path) { + return FilenameUtils.getExtension(path); + } + + public static String removeFileExtension(String path) { + return FilenameUtils.removeExtension(path); + } +} diff --git a/src/main/java/club/mcams/carpet/util/Messenger.java b/src/main/java/club/mcams/carpet/util/Messenger.java index f43224ef..6e05f46d 100644 --- a/src/main/java/club/mcams/carpet/util/Messenger.java +++ b/src/main/java/club/mcams/carpet/util/Messenger.java @@ -1,42 +1,233 @@ package club.mcams.carpet.util; -//#if MC >= 11600 && MC < 11900 -//$$ import net.minecraft.util.Util; -//#endif -//#if MC >= 11900 -//$$ import net.minecraft.text.Text; -//#endif +import club.mcams.carpet.mixin.translations.StyleAccessor; +import club.mcams.carpet.translations.AMSTranslations; +import club.mcams.carpet.translations.Translator; +import club.mcams.carpet.util.compat.DimensionWrapper; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.text.BaseText; -import net.minecraft.text.LiteralText; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.text.*; +import net.minecraft.util.Formatting; +import net.minecraft.util.math.ChunkPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; + +import com.google.common.collect.ImmutableMap; + +import org.jetbrains.annotations.Nullable; + +//#if MC>=11900 +//$$ import java.util.function.Supplier; +//#endif + + +/** + * Reference: Carpet TIS Addition + */ +public class Messenger { + private static final Translator translator = new Translator("util"); + + // Compound Text + public static BaseText c(Object... fields) { + //#if MC>=11900 + //$$ return (MutableText) carpet.utils.Messenger.c(fields); + //#else + return carpet.utils.Messenger.c(fields); + //#endif + } -public final class Messenger { // Simple Text public static BaseText s(Object text) { - return - //#if MC >= 11900 - //$$ Text.literal - //#else - new LiteralText - //#endif - (text.toString()); - } - - private static void __tell(ServerCommandSource source, BaseText text, boolean broadcastToOps) { - source.sendFeedback( - //#if MC >= 12000 - //$$ () -> - //#endif - text, broadcastToOps - ); + //#if MC>=11900 + //$$ return Text.literal(text.toString()); + //#else + return new LiteralText(text.toString()); + //#endif + } + + // Simple Text with carpet style + public static BaseText s(Object text, String carpetStyle) { + return formatting(s(text), carpetStyle); + } + + // Simple Text with formatting + public static BaseText s(Object text, Formatting textFormatting) { + return formatting(s(text), textFormatting); + } + + // Fancy Text + public static BaseText fancy(String carpetStyle, BaseText displayText, BaseText hoverText, ClickEvent clickEvent) { + BaseText text = copy(displayText); + if (carpetStyle != null) { + text.setStyle(parseCarpetStyle(carpetStyle)); + } + if (hoverText != null) { + hover(text, hoverText); + } + if (clickEvent != null) { + click(text, clickEvent); + } + return text; } - public static void tell(ServerCommandSource source, BaseText text, boolean broadcastToOps) - { - __tell(source, text, broadcastToOps); + public static BaseText fancy(BaseText displayText, BaseText hoverText, ClickEvent clickEvent) { + return fancy(null, displayText, hoverText, clickEvent); + } + + // Translation Text + public static BaseText tr(String key, Object... args) { + //#if MC>=11900 + //$$ return Text.translatable(key, args); + //#else + return new TranslatableText(key, args); + //#endif + } + + public static BaseText copy(BaseText text) { + return (BaseText) text.shallowCopy(); } public static void tell(ServerCommandSource source, BaseText text) { - tell(source, text, false); + Entity entity = source.getEntity(); + text = entity instanceof ServerPlayerEntity ? + AMSTranslations.translate(text, (ServerPlayerEntity) entity) : + AMSTranslations.translate(text); + //#if MC>=12000 + //$$ source.sendFeedback((Supplier) text, false); + //#else + source.sendFeedback(text, false); + //#endif + } + + public static BaseText formatting(BaseText text, Formatting... formattings) { + text.formatted(formattings); + return text; + } + + public static BaseText formatting(BaseText text, String carpetStyle) { + Style textStyle = text.getStyle(); + StyleAccessor parsedStyle = (StyleAccessor) parseCarpetStyle(carpetStyle); + textStyle = textStyle.withColor(parsedStyle.getColorField()); + textStyle = textStyle.withBold(parsedStyle.getBoldField()); + textStyle = textStyle.withItalic(parsedStyle.getItalicField()); + ((StyleAccessor) textStyle).setUnderlinedField(parsedStyle.getUnderlineField()); + ((StyleAccessor) textStyle).setStrikethroughField(parsedStyle.getStrikethroughField()); + ((StyleAccessor) textStyle).setObfuscatedField(parsedStyle.getObfuscatedField()); + return style(text, textStyle); + } + + public static BaseText style(BaseText text, Style style) { + text.setStyle(style); + return text; + } + + public static BaseText click(BaseText text, ClickEvent clickEvent) { + style(text, text.getStyle().withClickEvent(clickEvent)); + return text; + } + + public static BaseText hover(BaseText text, HoverEvent hoverEvent) { + style(text, text.getStyle().withHoverEvent(hoverEvent)); + return text; + } + + public static BaseText hover(BaseText text, BaseText hoverText) { + return hover(text, new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverText)); + } + + public static BaseText entity(String style, Entity entity) { + BaseText entityBaseName = (BaseText) entity.getType().getName(); + BaseText entityDisplayName = (BaseText) entity.getName(); + BaseText hoverText = Messenger.c( + translator.tr("entity_type", entityBaseName, s(EntityType.getId(entity.getType()).toString())), newLine(), + getTeleportHint(entityDisplayName) + ); + return fancy(style, entityDisplayName, hoverText, new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, TextUtil.tp(entity))); + } + + private static BaseText getTeleportHint(BaseText dest) { + return translator.tr("teleport_hint", dest); + } + + public static BaseText newLine() { + return s("\n"); + } + + private static final ImmutableMap DIMENSION_NAME = ImmutableMap.of( + DimensionWrapper.OVERWORLD, tr("createWorld.customize.preset.overworld"), + DimensionWrapper.THE_NETHER, tr("advancements.nether.root.title"), + DimensionWrapper.THE_END, tr("advancements.end.root.title") + ); + + public static BaseText dimension(DimensionWrapper dim) { + BaseText dimText = DIMENSION_NAME.get(dim); + return dimText != null ? copy(dimText) : Messenger.s(dim.getIdentifierString()); + } + + private static BaseText __coord(String style, @Nullable DimensionWrapper dim, String posStr, String command) { + BaseText hoverText = Messenger.s(""); + hoverText.append(getTeleportHint(Messenger.s(posStr))); + if (dim != null) { + hoverText.append("\n"); + hoverText.append(translator.tr("teleport_hint.dimension")); + hoverText.append(": "); + hoverText.append(dimension(dim)); + } + return fancy(style, Messenger.s(posStr), hoverText, new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command)); + } + + public static BaseText coord(String style, Vec3d pos, DimensionWrapper dim) { + return __coord(style, dim, TextUtil.coord(pos), TextUtil.tp(pos, dim)); + } + + public static BaseText coord(String style, Vec3i pos, DimensionWrapper dim) { + return __coord(style, dim, TextUtil.coord(pos), TextUtil.tp(pos, dim)); + } + + public static BaseText coord(String style, ChunkPos pos, DimensionWrapper dim) { + return __coord(style, dim, TextUtil.coord(pos), TextUtil.tp(pos, dim)); + } + + public static BaseText coord(String style, Vec3d pos) { + return __coord(style, null, TextUtil.coord(pos), TextUtil.tp(pos)); + } + + public static BaseText coord(String style, Vec3i pos) { + return __coord(style, null, TextUtil.coord(pos), TextUtil.tp(pos)); + } + + public static BaseText coord(String style, ChunkPos pos) { + return __coord(style, null, TextUtil.coord(pos), TextUtil.tp(pos)); + } + + public static BaseText coord(Vec3d pos, DimensionWrapper dim) { + return coord(null, pos, dim); + } + + public static BaseText coord(Vec3i pos, DimensionWrapper dim) { + return coord(null, pos, dim); + } + + public static BaseText coord(ChunkPos pos, DimensionWrapper dim) { + return coord(null, pos, dim); + } + + public static BaseText coord(Vec3d pos) { + return coord(null, pos); + } + + public static BaseText coord(Vec3i pos) { + return coord(null, pos); + } + + public static BaseText coord(ChunkPos pos) { + return coord(null, pos); + } + + public static Style parseCarpetStyle(String style) { + return carpet.utils.Messenger.parseStyle(style); } } diff --git a/src/main/java/club/mcams/carpet/util/TextUtil.java b/src/main/java/club/mcams/carpet/util/TextUtil.java new file mode 100644 index 00000000..b63f40ac --- /dev/null +++ b/src/main/java/club/mcams/carpet/util/TextUtil.java @@ -0,0 +1,58 @@ +package club.mcams.carpet.util; + +import club.mcams.carpet.util.compat.DimensionWrapper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.ChunkPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; + +/* + * Reference: Carpet TIS Addition + */ +public class TextUtil { + public static String tp(Vec3d pos) { + return String.format("/tp %s %s %s", pos.getX(), pos.getY(), pos.getZ()); + } + + public static String tp(Vec3i pos) { + return String.format("/tp %d %d %d", pos.getX(), pos.getY(), pos.getZ()); + } + + public static String tp(ChunkPos pos) { + return String.format("/tp %d ~ %d", pos.x * 16 + 8, pos.z * 16 + 8); + } + + public static String tp(Vec3d pos, DimensionWrapper dimensionType) { + return String.format("/execute in %s run", dimensionType) + tp(pos).replace('/', ' '); + } + + public static String tp(Vec3i pos, DimensionWrapper dimensionType) { + return String.format("/execute in %s run", dimensionType) + tp(pos).replace('/', ' '); + } + + public static String tp(ChunkPos pos, DimensionWrapper dimensionType) { + return String.format("/execute in %s run", dimensionType) + tp(pos).replace('/', ' '); + } + + public static String tp(Entity entity) { + if (entity instanceof PlayerEntity) { + String name = ((PlayerEntity) entity).getGameProfile().getName(); + return String.format("/tp %s", name); + } + String uuid = entity.getUuid().toString(); + return String.format("/tp %s", uuid); + } + + public static String coord(Vec3d pos) { + return String.format("[%.1f, %.1f, %.1f]", pos.getX(), pos.getY(), pos.getZ()); + } + + public static String coord(Vec3i pos) { + return String.format("[%d, %d, %d]", pos.getX(), pos.getY(), pos.getZ()); + } + + public static String coord(ChunkPos pos) { + return String.format("[%d, %d]", pos.x, pos.z); + } +} diff --git a/src/main/java/club/mcams/carpet/util/compat/DimensionWrapper.java b/src/main/java/club/mcams/carpet/util/compat/DimensionWrapper.java new file mode 100644 index 00000000..8b62a6be --- /dev/null +++ b/src/main/java/club/mcams/carpet/util/compat/DimensionWrapper.java @@ -0,0 +1,69 @@ +package club.mcams.carpet.util.compat; + +import net.minecraft.entity.Entity; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.RegistryKey; +import net.minecraft.world.World; + +import java.util.Objects; + +/* + * Reference: Carpet TIS Addition + * A wrapper class to deal with dimension type class differences between minecraft version: + * - RegistryKey in 1.15- + * - RegistryKey in 1.16+ + */ +public class DimensionWrapper { + public static final DimensionWrapper OVERWORLD = of(World.OVERWORLD); + public static final DimensionWrapper THE_NETHER = of(World.NETHER); + public static final DimensionWrapper THE_END = of(World.END); + + private final RegistryKey dimensionType; + + public DimensionWrapper(RegistryKey dimensionType) { + this.dimensionType = dimensionType; + } + + public static DimensionWrapper of(RegistryKey dimensionType) { + return new DimensionWrapper(dimensionType); + } + + public static DimensionWrapper of(World world) { + return new DimensionWrapper(world.getRegistryKey()); + } + + public static DimensionWrapper of(Entity entity) { + return of(entity.getEntityWorld()); + } + + public RegistryKey getValue() { + return this.dimensionType; + } + + public Identifier getIdentifier() { + return this.dimensionType.getValue(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DimensionWrapper that = (DimensionWrapper) o; + return Objects.equals(dimensionType, that.dimensionType); + } + + @Override + public int hashCode() { + return this.dimensionType.hashCode(); + } + + public String getIdentifierString() { + return this.getIdentifier().toString(); + } + + @Deprecated + @Override + public String toString() { + return this.getIdentifierString(); + } +} diff --git a/src/main/java/test/java/club/mcams/carpet/TranslationTest.java b/src/main/java/test/java/club/mcams/carpet/TranslationTest.java new file mode 100644 index 00000000..5993d607 --- /dev/null +++ b/src/main/java/test/java/club/mcams/carpet/TranslationTest.java @@ -0,0 +1,10 @@ +package test.java.club.mcams.carpet; + +import club.mcams.carpet.translations.AMSTranslations; + +public class TranslationTest { + public static void main(String[] args) { + AMSTranslations.loadTranslations(); + System.out.println(AMSTranslations.getTranslation("zh_cn")); + } +} diff --git a/src/main/resources/amscarpet.mixins.json b/src/main/resources/amscarpet.mixins.json index 310089a2..21e4a34e 100644 --- a/src/main/resources/amscarpet.mixins.json +++ b/src/main/resources/amscarpet.mixins.json @@ -37,7 +37,16 @@ "rule.sharedVillagerDiscounts.VillagerGossipsMixin", "rule.softBlock.AbstractBlockStateMixin", "rule.superBow.InfinityEnchantmentMixin", - "rule.weakBlocks.CollectBlocksAndDamageEntitiesMixin" + "rule.weakBlocks.CollectBlocksAndDamageEntitiesMixin", + "setting.ParsedRuleAccessor", + "setting.SettingsManagerAccessor", + "translations.ClientSettingsC2SPacketAccessor", + "translations.HUDControllerMixin", + "translations.LoggerMixin", + "translations.ServerPlayerEntityMixin", + "translations.StyleAccessor", + "translations.TranslatableTextAccessor", + "translations.TranslatableTextMixin" ], "client": [], "server": [], diff --git a/src/main/resources/assets/carpet-ams-addition/lang/en_us.json b/src/main/resources/assets/carpet-ams-addition/lang/en_us.json deleted file mode 100644 index 02dbba69..00000000 --- a/src/main/resources/assets/carpet-ams-addition/lang/en_us.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "category.AMS": "AMS", - "category.crafting": "crafting", - "category.AMS_movable": "AMS_movable", - "category.AMS_chunkLoader": "AMS_chunkLoader", - - "rule.superBow.name": "superBow", - "rule.superBow.desc": "Enabling making super bows with both infinite and mending enchants", - "rule.sharedVillagerDiscounts.name": "sharedVillagerDiscounts", - "rule.sharedVillagerDiscounts.desc": "Share villagers discount to all players", - "rule.fakePeace.name": "fakePeace", - "rule.fakePeace.desc": "Simulation fake Peace", - "rule.extinguishedCampfire.name": "extinguishedCampfire", - "rule.extinguishedCampfire.desc": "The campfire is extinguished when the player places it", - "rule.softDeepslate.name": "softDeepslate", - "rule.softDeepslate.desc": "Change the hardness of deepslate to stone", - "rule.softObsidian.name": "softObsdian", - "rule.softObsidian.desc": "Change the hardness of obsidian to deepslate", - "rule.blowUpEverything.name": "destroysEverything", - "rule.blowUpEverything.desc": "Set all blocks BlastResistance to 0", - "rule.netherWaterPlacement.name": "netherWaterPlacement", - "rule.netherWaterPlacement.desc": "Players can use water buckets to place water in nether", - "rule.optimizedDragonRespawn.name": "optimizedDragonRespawn", - "rule.optimizedDragonRespawn.desc": "Optimize dragon respawning", - "rule.safeFlight.name": "safeFlight", - "rule.safeFlight.desc": "players don't get hurt by flying into walls", - "rule.boneBlockUpdateSuppressor.name": "boneBlockUpdateSuppressor", - "rule.boneBlockUpdateSuppressor.desc": "Let the bone_block be update suppressor", - "rule.weakObsidian.name": "destroysObsidian", - "rule.weakObsidian.desc": "Explosion can destroy Obsidian", - "rule.weakCryingObsidian.name": "destroysCryingObsidian", - "rule.weakCryingObsidian.desc": "Explosion can destroy crying_obsidian", - "rule.weakReinforcedDeepslate.name": "destroysReinforcedDeepslate", - "rule.weakReinforcedDeepslate.desc": "Explosion can destroy ReinforcedDeepslate", - "rule.weakBedRock.name": "destroysBedrock", - "rule.weakBedRock.desc": "Explosion can destroy bedrock", - "rule.enhancedWorldEater.name": "enhancedWorldEater", - "rule.enhancedWorldEater.desc": "Explosion can destroy all blocks except anvil and bedrock", - "rule.infiniteTrades.name": "infiniteTrades", - "rule.infiniteTrades.desc": "Prevents villager trades from locking up", - "rule.invulnerable.name": "invulnerable", - "rule.invulnerable.desc": "Players will be invulnerable", - "rule.creativeOneHitKill.name": "creativeOneHitKill", - "rule.creativeOneHitKill.desc": "Allows players in Creative mode to kill entities in one hit\nIf the player is sneaking, other entities around the target get killed too", - "rule.largeEnderChest.name": "largeEnderChest", - "rule.largeEnderChest.desc": "Doubles the size of your EnderChest", - "rule.bambooModelNoOffset.name": "bambooModelNoOffset", - "rule.bambooModelNoOffset.desc": "The block model of bamboo will not generate offset", - "rule.bambooCollisionBoxDisabled.name": "bambooCollisionBoxDisabled", - "rule.bambooCollisionBoxDisabled.desc": "Allow players to pass through bamboo", - "rule.campfireSmokeParticleDisabled.name": "CampfireSmokeParticleDisabled", - "rule.campfireSmokeParticleDisabled.desc": "Disable campfire smoke particles", - "rule.antiFireTotem.name": "antiFireTotem", - "rule.antiFireTotem.desc": "Totem will not be destroyed by flames and magma", - "rule.itemAntiExplosion.name": "itemAntiExplosion", - "rule.itemAntiExplosion.desc": "Dropped items will not be destroyed by explosions", - "rule.creativeShulkerBoxDropsDisable.name": "creativeShulkerBoxDropsDisable", - "rule.creativeShulkerBoxDropsDisable.desc": "Breaking a shulker box with items in creative mode will not cause drops", - - "rule.scheduledRandomTickCactus.name": "scheduledRandomTickCactus", - "rule.scheduledRandomTickCactus.desc": "Make cactus accepts scheduled tick as random tick", - "rule.scheduledRandomTickBamboo.name": "scheduledRandomTickBamboo", - "rule.scheduledRandomTickBamboo.desc": "Make bamboo accepts scheduled tick as random tick", - "rule.scheduledRandomTickChorusFlower.name": "scheduledRandomTickChorusFlower", - "rule.scheduledRandomTickChorusFlower.desc": "Make chorus flower accepts scheduled tick as random tick", - "rule.scheduledRandomTickSugarCane.name": "scheduledRandomTickSugarCane", - "rule.scheduledRandomTickSugarCane.desc": "Make sugar cane accepts scheduled tick as random tick", - "rule.scheduledRandomTickStem.name": "scheduledRandomTickStem", - "rule.scheduledRandomTickStem.desc": "Make stems accepts scheduled tick as random tick", - "rule.scheduledRandomTickAllPlants.name": "scheduledRandomTickAllPlants", - "rule.scheduledRandomTickAllPlants.desc": "Make all plants accepts scheduled tick as random tick", - - "rule.commandChunkLoading.name": "commandChunkLoading", - "rule.commandChunkLoading.desc": "Control chunk loading for players at any gamemodes", - "rule.noteBlockChunkLoader.name": "noteBlockChunkLoader", - "rule.noteBlockChunkLoader.desc": "Load nearby 3x3 chunks for 15 seconds when a note block is triggered", - "rule.noteBlockChunkLoader.extra.0": "[bone_block] - When bone_block is on the note_block", - "rule.noteBlockChunkLoader.extra.1": "[wither_skeleton_skull] - When wither_skeleton_skull is on the note_block, either placed on the note block or hanging on the wall", - "rule.noteBlockChunkLoader.extra.2": "[note_block] - Only note_block", - "rule.noteBlockChunkLoader.extra.3": "[OFF] - Disable the rule", - "rule.bellBlockChunkLoader.name": "bellChunkLoader", - "rule.bellBlockChunkLoader.desc": "Load nearby 3x3 chunks for 15 seconds when a bell is triggered", - "rule.pistonBlockChunkLoader.name": "pistonBlockChunkLoader", - "rule.pistonBlockChunkLoader.desc": "Load nearby 3x3 chunks for 15 seconds when a piston is triggered (Centered on the piston head)", - "rule.pistonBlockChunkLoader.extra.0": "[bone_block] - When bone_block is on the piston", - "rule.pistonBlockChunkLoader.extra.1": "[bedrock] - When bedrock is under the piston", - "rule.pistonBlockChunkLoader.extra.2": "[all] - When bone_block is on the piston or bedrock is under the piston", - "rule.pistonBlockChunkLoader.extra.3": "[OFF] - Disable the rule", - - "rule.movableEnderChest.name": "movableEnderChest", - "rule.movableEnderChest.desc": "Makes ender_chests movable", - "rule.movableEndPortalFrame.name": "movableEndPortalFrame", - "rule.movableEndPortalFrame.desc": "Makes end_portal_frame movable", - "rule.movableObsidian.name": "movableObsidian", - "rule.movableObsidian.desc": "Makes obsidian movable", - "rule.movableCryingObsidian.name": "movableCryingObsidian", - "rule.movableCryingObsidian.desc": "Makes crying_obsidian movable", - "rule.movableBedRock.name": "movableBedRock", - "rule.movableBedRock.desc": "Makes bedrock movable", - "rule.movableEnchantingTable.name": "movableEnchantingTable", - "rule.movableEnchantingTable.desc": "Makes enchanting_table movable", - "rule.movableBeacon.name": "movableBeacon", - "rule.movableBeacon.desc": "Makes beacon movable", - "rule.movableReinforcedDeepslate.name": "movableReinforcedDeepslate", - "rule.movableReinforcedDeepslate.desc": "Makes reinforced_deepslate movable", - "rule.movableAnvil.name": "movableAnvil", - "rule.movableAnvil.desc": "Makes anvil movable", - - "rule.craftableEnchantedGoldenApples.name": "craftableEnchantedGoldenApples", - "rule.craftableEnchantedGoldenApples.desc": "Enchanted Golden Apples can be crafted with 8 Gold Blocks again", - "rule.craftableBundle.name": "craftableBundle", - "rule.craftableBundle.desc": "Crafted bundle in minecraft 1.17/1.18/1.19", - "rule.craftableSculkSensor.name": "craftableSculkSensor", - "rule.craftableSculkSensor.desc": "Crafted sculk_sensor in minecraft 1.17/1.18", - "rule.betterCraftableBoneBlock.name": "betterCraftableBoneBlock", - "rule.betterCraftableBoneBlock.desc": "Use nine bones to crafted three bone_blocks", - "rule.craftableElytra.name": "craftableElytra", - "rule.craftableElytra.desc": "Add elytra recipes in minecraft", - "rule.betterCraftableDispenser.name": "betterCraftableDispenser", - "rule.betterCraftableDispenser.desc": "Better craftable dispenser", - "rule.betterCraftablePolishedBlackStoneButton.name": "betterCraftablePolishedBlackStoneButton", - "rule.betterCraftablePolishedBlackStoneButton.desc": "Use deepslate to crafted polished_blackstone_button in minecraft" -} \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/lang/zh_cn.json b/src/main/resources/assets/carpet-ams-addition/lang/zh_cn.json deleted file mode 100644 index 9b0f42ed..00000000 --- a/src/main/resources/assets/carpet-ams-addition/lang/zh_cn.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "category.AMS": "AMS", - "category.crafting": "制造", - "category.AMS_movable": "AMS_可移动方块", - "category.AMS_chunkLoader": "AMS_区块加载", - - "rule.superBow.name": "超级弓", - "rule.superBow.desc": "让弓能同时打上无限和经验修补两种附魔", - "rule.sharedVillagerDiscounts.name": "共享打折", - "rule.sharedVillagerDiscounts.desc": "玩家将僵尸村民治疗为村民后的获得的折扣将共享给所有玩家", - "rule.fakePeace.name": "伪和平", - "rule.fakePeace.desc": "伪和平", - "rule.extinguishedCampfire.name": "熄灭的篝火", - "rule.extinguishedCampfire.desc": "当玩家放置篝火时,篝火处于熄灭状态", - "rule.netherWaterPlacement.name": "地狱可放水", - "rule.netherWaterPlacement.desc": "玩家可以在地狱使用水桶放置水", - "rule.softDeepslate.name": "易碎深板岩", - "rule.softDeepslate.desc": "改变深板岩的硬度使其和普通石头一致", - "rule.softObsidian.name": "易碎黑曜石", - "rule.softObsidian.desc": "改变深板岩的硬度使其和深板岩一致", - "rule.blowUpEverything.name": "炸毁所有方块", - "rule.blowUpEverything.desc": "让所有方块的爆炸抗性为0", - "rule.optimizedDragonRespawn.name": "龙战优化", - "rule.optimizedDragonRespawn.desc": "大幅度优化龙战定位末地门过程,为基于末地门的末地石农场设计", - "rule.safeFlight.name": "安全飞行", - "rule.safeFlight.desc": "玩家使用鞘翅飞行时不会因为撞到墙壁而受到伤害", - "rule.boneBlockUpdateSuppressor.name": "骨块更新抑制器", - "rule.boneBlockUpdateSuppressor.desc": "让骨块成为一个更新抑制器", - "rule.weakObsidian.name": "炸毁黑曜石", - "rule.weakObsidian.desc": "爆炸可以摧毁黑曜石", - "rule.weakCryingObsidian.name": "炸毁哭泣的黑曜石", - "rule.weakCryingObsidian.desc": "爆炸可以摧毁哭泣的黑曜石", - "rule.weakReinforcedDeepslate.name": "炸毁强化深板岩", - "rule.weakReinforcedDeepslate.desc": "爆炸可以摧毁强化深板岩", - "rule.weakBedRock.name": "炸毁基岩", - "rule.weakBedRock.desc": "爆炸可以摧毁基岩", - "rule.enhancedWorldEater.name": "增强型世界吞噬者", - "rule.enhancedWorldEater.desc": "爆炸可以摧毁除了铁砧与基岩外的所有方块", - "rule.infiniteTrades.name": "无限交易", - "rule.infiniteTrades.desc": "防止村民交易被锁定", - "rule.invulnerable.name": "无懈可击", - "rule.invulnerable.desc": "玩家将免受一切伤害", - "rule.creativeOneHitKill.name": "创造模式一击必杀", - "rule.creativeOneHitKill.desc": "当玩家在创造模式下时可以做到一击必杀\n当玩家处于潜行状态时,周围的实体也会被杀死", - "rule.largeEnderChest.name": "大末影箱", - "rule.largeEnderChest.desc": "让你的末影箱容量增加一倍(与大箱子相同)", - "rule.bambooModelNoOffset.name": "竹子模型无偏移", - "rule.bambooModelNoOffset.desc": "让竹子的模型不会产生偏移", - "rule.bambooCollisionBoxDisabled.name": "禁用竹子碰撞箱", - "rule.bambooCollisionBoxDisabled.desc": "允许玩家穿过竹子", - "rule.campfireSmokeParticleDisabled.name": "禁用篝火烟雾粒子", - "rule.campfireSmokeParticleDisabled.desc": "篝火将不会产生烟雾粒子", - "rule.antiFireTotem.name": "防火图腾", - "rule.antiFireTotem.desc": "图腾将不会被火焰或者岩浆烧毁", - "rule.itemAntiExplosion.name": "掉落物防爆", - "rule.itemAntiExplosion.desc": "掉落物将不会被爆炸摧毁", - "rule.creativeShulkerBoxDropsDisable.name": "创造模式潜影盒无掉落", - "rule.creativeShulkerBoxDropsDisable.desc": "当玩家处于创造模式下时,破坏装有物品的潜影盒也不会产生掉落", - - "rule.scheduledRandomTickCactus.name": "计划刻催熟仙人掌", - "rule.scheduledRandomTickCactus.desc": "当仙人掌方块收到计划刻时仍会给予生长随机刻", - "rule.scheduledRandomTickBamboo.name": "计划刻催熟竹子", - "rule.scheduledRandomTickBamboo.desc": "当竹子方块收到计划刻时仍会给予生长随机刻", - "rule.scheduledRandomTickChorusFlower.name": "计划刻催熟紫颂花", - "rule.scheduledRandomTickChorusFlower.desc": "当紫颂花方块收到计划刻时仍会给予生长随机刻", - "rule.scheduledRandomTickSugarCane.name": "计划刻催熟甘蔗", - "rule.scheduledRandomTickSugarCane.desc": "当甘蔗方块收到计划刻时仍会给予生长随机刻", - "rule.scheduledRandomTickStem.name": "计划刻催熟海带、缠怨藤、垂泪藤", - "rule.scheduledRandomTickStem.desc": "当海带、缠怨藤、垂泪藤方块收到计划刻时仍会给予生长随机刻", - "rule.scheduledRandomTickAllPlants.name": "计划刻催熟所有作物", - "rule.scheduledRandomTickAllPlants.desc": "当所有作物方块收到计划刻时仍会给予生长随机刻", - - "rule.commandChunkLoading.name": "区块加载控制", - "rule.commandChunkLoading.desc": "控制任意游戏模式下玩家对周围区块的加载", - "rule.noteBlockChunkLoader.name": "音符盒区块加载", - "rule.noteBlockChunkLoader.desc": "音符盒方块被激活时将加载周围3x3区块15s", - "rule.noteBlockChunkLoader.extra.0": "[bone_block] - 音符盒上方有骨块可以触发加载", - "rule.noteBlockChunkLoader.extra.1": "[wither_skeleton_skull] - 音符盒上有凋灵骷髅头(可以是挂在墙上的也可以是放在音符盒上的)时可以触发加载", - "rule.noteBlockChunkLoader.extra.2": "[note_block] - 无需条件,只有音符盒即可加载", - "rule.noteBlockChunkLoader.extra.3": "[OFF] - 禁用该规则", - "rule.bellBlockChunkLoader.name": "钟区块加载", - "rule.bellBlockChunkLoader.desc": "钟方块被激活时将加载周围3x3区块15s", - "rule.pistonBlockChunkLoader.name": "活塞头区块加载", - "rule.pistonBlockChunkLoader.desc": "活塞或黏性活塞被激活且能正常伸出时以活塞头将到达的区块为中心加载3x3区块持续15s", - "rule.pistonBlockChunkLoader.extra.0": "[bone_block] - 当活塞/黏性活塞上方有骨块时", - "rule.pistonBlockChunkLoader.extra.1": "[bedrock] - 当活塞/黏性活塞下方有基岩时", - "rule.pistonBlockChunkLoader.extra.2": "[all] - 当活塞/黏性活塞上方有骨块或下方有基岩时", - "rule.pistonBlockChunkLoader.extra.3": "[OFF] - 禁用该规则", - - "rule.movableEnderChest.name": "可移动末影箱", - "rule.movableEnderChest.desc": "让末影箱可以被活塞/黏性活塞推动", - "rule.movableEndPortalFrame.name": "可移动末地传送门框架", - "rule.movableEndPortalFrame.desc": "让末地传送门框架可以被活塞/黏性活塞推动", - "rule.movableObsidian.name": "可移动黑曜石", - "rule.movableObsidian.desc": "让黑曜石可以被活塞/黏性活塞推动", - "rule.movableCryingObsidian.name": "可移动哭泣的黑曜石", - "rule.movableCryingObsidian.desc": "让哭泣的黑曜石可以被活塞/黏性活塞推动", - "rule.movableBedRock.name": "可移动基岩", - "rule.movableBedRock.desc": "让基岩可以被活塞/黏性活塞推动", - "rule.movableEnchantingTable.name": "可移动附魔台", - "rule.movableEnchantingTable.desc": "让附魔台可以被活塞/黏性活塞推动", - "rule.movableBeacon.name": "可移动信标", - "rule.movableBeacon.desc": "让信标可以被活塞/黏性活塞推动", - "rule.movableReinforcedDeepslate.name": "可移动强化深板岩", - "rule.movableReinforcedDeepslate.desc": "让强化深板岩可以被活塞/黏性活塞推动", - "rule.movableAnvil.name": "可移动铁砧", - "rule.movableAnvil.desc": "让铁砧可以被活塞/黏性活塞推动", - - "rule.craftableEnchantedGoldenApples.name": "可合成附魔金苹果", - "rule.craftableEnchantedGoldenApples.desc": "使用老版本的方式来合成附魔金苹果(8金块+1苹果)", - "rule.craftableBundle.name": "可合成收纳袋", - "rule.craftableBundle.desc": "玩家可以在Minecraft 1.17/1.18/1.19中合成收纳袋", - "rule.craftableSculkSensor.name": "可合成幽匿感测体", - "rule.craftableSculkSensor.desc": "玩家可以在Minecraft 1.17/1.18中合成幽匿感测体", - "rule.betterCraftableBoneBlock.name": "更好的骨块合成", - "rule.betterCraftableBoneBlock.desc": "使用9个骨头可以合成出3个骨块(一点都不卡!)", - "rule.craftableElytra.name": "可合成鞘翅", - "rule.craftableElytra.desc": "添加了鞘翅的合成配方", - "rule.betterCraftableDispenser.name": "更好的合成发射器", - "rule.betterCraftableDispenser.desc": "使用更灵活的配方来合成发射器", - "rule.betterCraftablePolishedBlackStoneButton.name": "更好的合成磨制黑石按钮", - "rule.betterCraftablePolishedBlackStoneButton.desc": "使用深板岩来合成磨制黑石按钮" -} \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/lang_1.19+/en_us.json b/src/main/resources/assets/carpet-ams-addition/lang_1.19+/en_us.json deleted file mode 100644 index 6d3661e7..00000000 --- a/src/main/resources/assets/carpet-ams-addition/lang_1.19+/en_us.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "carpet.category.AMS": "AMS", - "carpet.category.crafting": "crafting", - "carpet.category.AMS_movable": "AMS_movable", - "carpet.category.AMS_chunkLoader": "AMS_chunkLoader", - - "carpet.rule.superBow.name": "superBow", - "carpet.rule.superBow.desc": "Enabling making super bows with both infinite and mending enchants", - "carpet.rule.sharedVillagerDiscounts.name": "sharedVillagerDiscounts", - "carpet.rule.sharedVillagerDiscounts.desc": "Share villagers discount to all players", - "carpet.rule.fakePeace.name": "fakePeace", - "carpet.rule.fakePeace.desc": "Simulation fake Peace", - "carpet.rule.extinguishedCampfire.name": "extinguishedCampfire", - "carpet.rule.extinguishedCampfire.desc": "The campfire is extinguished when the player places it", - "carpet.rule.netherWaterPlacement.name": "netherWaterPlacement", - "carpet.rule.netherWaterPlacement.desc": "Players can use water buckets to place water in nether", - "carpet.rule.softDeepslate.name": "softDeepslate", - "carpet.rule.softDeepslate.desc": "Change the hardness of deepslate to stone", - "carpet.rule.softObsidian.name": "softObsdian", - "carpet.rule.softObsidian.desc": "Change the hardness of obsidian to deepslate", - "carpet.rule.blowUpEverything.name": "destroysEverything", - "carpet.rule.blowUpEverything.desc": "Set all blocks BlastResistance to 0", - "carpet.rule.optimizedDragonRespawn.name": "optimizedDragonRespawn", - "carpet.rule.optimizedDragonRespawn.desc": "Optimize dragon respawning", - "carpet.rule.safeFlight.name": "safeFlight", - "carpet.rule.safeFlight.desc": "players don't get hurt by flying into walls", - "carpet.rule.weakObsidian.name": "destroysObsidian", - "carpet.rule.weakObsidian.desc": "Explosion can destroy Obsidian", - "carpet.rule.weakCryingObsidian.name": "destroysCryingObsidian", - "carpet.rule.weakCryingObsidian.desc": "Explosion can destroy crying_obsidian", - "carpet.rule.weakReinforcedDeepslate.name": "destroysReinforcedDeepslate", - "carpet.rule.weakReinforcedDeepslate.desc": "Explosion can destroy ReinforcedDeepslate", - "carpet.rule.weakBedRock.name": "destroysBedRock", - "carpet.rule.weakBedRock.desc": "Explosion can destroy bedrock", - "carpet.rule.enhancedWorldEater.name": "enhancedWorldEater", - "carpet.rule.enhancedWorldEater.desc": "Explosion can destroy all blocks except anvil and bedrock", - "carpet.rule.infiniteTrades.name": "infiniteTrades", - "carpet.rule.infiniteTrades.desc": "Prevents villager trades from locking up", - "carpet.rule.invulnerable.name": "invulnerable", - "carpet.rule.invulnerable.desc": "Players will be invulnerable", - "carpet.rule.creativeOneHitKill.name": "creativeOneHitKill", - "carpet.rule.creativeOneHitKill.desc": "Allows players in Creative mode to kill entities in one hit\nIf the player is sneaking, other entities around the target get killed too", - "carpet.rule.largeEnderChest.name": "largeEnderChest", - "carpet.rule.largeEnderChest.desc": "Doubles the size of your EnderChest", - "carpet.rule.bambooModelNoOffset.name": "bambooModelNoOffset", - "carpet.rule.bambooModelNoOffset.desc": "The block model of bamboo will not generate offset", - "carpet.rule.bambooCollisionBoxDisabled.name": "bambooCollisionBoxDisabled", - "carpet.rule.bambooCollisionBoxDisabled.desc": "Allow players to pass through bamboo", - "carpet.rule.campfireSmokeParticleDisabled.name": "CampfireSmokeParticleDisabled", - "carpet.rule.campfireSmokeParticleDisabled.desc": "Disable campfire smoke particles", - "carpet.rule.antiFireTotem.name": "antiFireTotem", - "carpet.rule.antiFireTotem.desc": "Totem will not be destroyed by flames and magma", - "carpet.rule.itemAntiExplosion.name": "itemAntiExplosion", - "carpet.rule.itemAntiExplosion.desc": "Dropped items will not be destroyed by explosions", - "carpet.rule.creativeShulkerBoxDropsDisable.name": "creativeShulkerBoxDropsDisable", - "carpet.rule.creativeShulkerBoxDropsDisable.desc": "Breaking a shulker box with items in creative mode will not cause drops", - - "carpet.rule.scheduledRandomTickCactus.name": "scheduledRandomTickCactus", - "carpet.rule.scheduledRandomTickCactus.desc": "Make cactus accepts scheduled tick as random tick", - "carpet.rule.scheduledRandomTickBamboo.name": "scheduledRandomTickBamboo", - "carpet.rule.scheduledRandomTickBamboo.desc": "Make bamboo accepts scheduled tick as random tick", - "carpet.rule.scheduledRandomTickChorusFlower.name": "scheduledRandomTickChorusFlower", - "carpet.rule.scheduledRandomTickChorusFlower.desc": "Make chorus flower accepts scheduled tick as random tick", - "carpet.rule.scheduledRandomTickSugarCane.name": "scheduledRandomTickSugarCane", - "carpet.rule.scheduledRandomTickSugarCane.desc": "Make sugar cane accepts scheduled tick as random tick", - "carpet.rule.scheduledRandomTickStem.name": "scheduledRandomTickStem", - "carpet.rule.scheduledRandomTickStem.desc": "Make stems accepts scheduled tick as random tick", - "carpet.rule.scheduledRandomTickAllPlants.name": "scheduledRandomTickAllPlants", - "carpet.rule.scheduledRandomTickAllPlants.desc": "Make all plants accepts scheduled tick as random tick", - - "carpet.rule.commandChunkLoading.name": "commandChunkLoading", - "carpet.rule.commandChunkLoading.desc": "Control chunk loading for players at any gamemodes", - "carpet.rule.noteBlockChunkLoader.name": "noteBlockChunkLoader", - "carpet.rule.noteBlockChunkLoader.desc": "Load nearby 3x3 chunks for 15 seconds when a note block is triggered", - "carpet.rule.noteBlockChunkLoader.extra.0": "[bone_block] - When bone_block is on the note_block", - "carpet.rule.noteBlockChunkLoader.extra.1": "[wither_skeleton_skull] - When wither_skeleton_skull is on the note_block, either placed on the note block or hanging on the wall", - "carpet.rule.noteBlockChunkLoader.extra.2": "[note_block] - Only note_block", - "carpet.rule.noteBlockChunkLoader.extra.3": "[OFF] - Disable the rule", - "carpet.rule.bellBlockChunkLoader.name": "bellChunkLoader", - "carpet.rule.bellBlockChunkLoader.desc": "Load nearby 3x3 chunks for 15 seconds when a bell is triggered", - "carpet.rule.pistonBlockChunkLoader.name": "pistonBlockChunkLoader", - "carpet.rule.pistonBlockChunkLoader.desc": "Load nearby 3x3 chunks for 15 seconds when a piston is triggered (Centered on the piston head)", - "carpet.rule.pistonBlockChunkLoader.extra.0": "[bone_block] - When bone_block is on the piston", - "carpet.rule.pistonBlockChunkLoader.extra.1": "[bedrock] - When bedrock is under the piston", - "carpet.rule.pistonBlockChunkLoader.extra.2": "[all] - When bone_block is on the piston or bedrock is under the piston", - "carpet.rule.pistonBlockChunkLoader.extra.3": "[OFF] - Disable the rule", - - "carpet.rule.movableEnderChest.name": "movableEnderChest", - "carpet.rule.movableEnderChest.desc": "Makes ender_chests movable", - "carpet.rule.movableEndPortalFrame.name": "movableEndPortalFrame", - "carpet.rule.movableEndPortalFrame.desc": "Makes end_portal_frame movable", - "carpet.rule.movableObsidian.name": "movableObsidian", - "carpet.rule.movableObsidian.desc": "Makes obsidian movable", - "carpet.rule.movableCryingObsidian.name": "movableCryingObsidian", - "carpet.rule.movableCryingObsidian.desc": "Makes crying_obsidian movable", - "carpet.rule.movableBedRock.name": "movableBedRock", - "carpet.rule.movableBedRock.desc": "Makes bedrock movable", - "carpet.rule.movableEnchantingTable.name": "movableEnchantingTable", - "carpet.rule.movableEnchantingTable.desc": "Makes enchanting_table movable", - "carpet.rule.movableBeacon.name": "movableBeacon", - "carpet.rule.movableBeacon.desc": "Makes beacon movable", - "carpet.rule.movableReinforcedDeepslate.name": "movableReinforcedDeepslate", - "carpet.rule.movableReinforcedDeepslate.desc": "Makes reinforced_deepslate movable", - "carpet.rule.movableAnvil.name": "movableAnvil", - "carpet.rule.movableAnvil.desc": "Makes anvil movable", - "carpet.rule.movableSculkCatalyst.name": "movableSculkCatalyst", - "carpet.rule.movableSculkCatalyst.desc": "Makes sculk_catalyst movable", - "carpet.rule.movableSculkSensor.name": "Makes sculk_catalyst movable", - "carpet.rule.movableSculkSensor.desc": "Makes sculk_sensor movable", - "carpet.rule.movableSculkShrieker.name": "Makes sculk_shrieker movable", - "carpet.rule.movableSculkShrieker.desc": "Makes sculk_shrieker movable", - - "carpet.rule.craftableEnchantedGoldenApples.name": "craftableEnchantedGoldenApples", - "carpet.rule.craftableEnchantedGoldenApples.desc": "Enchanted Golden Apples can be crafted with 8 Gold Blocks again", - "carpet.rule.craftableBundle.name": "craftableBundle", - "carpet.rule.craftableBundle.desc": "Crafted bundle in minecraft 1.17/1.18/1.19", - "carpet.rule.craftableSculkSensor.name": "craftableSculkSensor", - "carpet.rule.craftableSculkSensor.desc": "Crafted sculk_sensor in minecraft 1.17/1.18", - "carpet.rule.betterCraftableBoneBlock.name": "betterCraftableBoneBlock", - "carpet.rule.betterCraftableBoneBlock.desc": "Use nine bones to crafted three bone_blocks", - "carpet.rule.craftableElytra.name": "craftableElytra", - "carpet.rule.craftableElytra.desc": "Add elytra recipes in minecraft", - "carpet.rule.betterCraftableDispenser.name": "betterCraftableDispenser", - "carpet.rule.betterCraftableDispenser.desc": "Better craftable dispenser", - "carpet.rule.betterCraftablePolishedBlackStoneButton.name": "betterCraftablePolishedBlackStoneButton", - "carpet.rule.betterCraftablePolishedBlackStoneButton.desc": "Use deepslate to crafted polished_blackstone_button in minecraft" -} \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/lang_1.19+/zh_cn.json b/src/main/resources/assets/carpet-ams-addition/lang_1.19+/zh_cn.json deleted file mode 100644 index fa9ba2a1..00000000 --- a/src/main/resources/assets/carpet-ams-addition/lang_1.19+/zh_cn.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "carpet.category.AMS": "AMS", - "carpet.category.crafting": "制造", - "carpet.category.AMS_movable": "AMS_可移动方块", - "carpet.category.AMS_chunkLoader": "AMS_区块加载", - - "carpet.rule.superBow.name": "超级弓", - "carpet.rule.superBow.desc": "让弓能同时打上无限和经验修补两种附魔", - "carpet.rule.sharedVillagerDiscounts.name": "共享打折", - "carpet.rule.sharedVillagerDiscounts.desc": "玩家将僵尸村民治疗为村民后的获得的折扣将共享给所有玩家", - "carpet.rule.fakePeace.name": "伪和平", - "carpet.rule.fakePeace.desc": "伪和平", - "carpet.rule.extinguishedCampfire.name": "熄灭的篝火", - "carpet.rule.extinguishedCampfire.desc": "当玩家放置篝火时,篝火处于熄灭状态", - "carpet.rule.netherWaterPlacement.name": "地狱可放水", - "carpet.rule.netherWaterPlacement.desc": "玩家可以在地狱使用水桶放置水", - "carpet.rule.softDeepslate.name": "易碎深板岩", - "carpet.rule.softDeepslate.desc": "改变深板岩的硬度使其和普通石头一致", - "carpet.rule.softObsidian.name": "易碎黑曜石", - "carpet.rule.softObsidian.desc": "改变深板岩的硬度使其和深板岩一致", - "carpet.rule.blowUpEverything.name": "炸毁所有方块", - "carpet.rule.blowUpEverything.desc": "让所有方块的爆炸抗性为0", - "carpet.rule.optimizedDragonRespawn.name": "龙战优化", - "carpet.rule.optimizedDragonRespawn.desc": "大幅度优化龙战定位末地门过程,为基于末地门的末地石农场设计", - "carpet.rule.safeFlight.name": "安全飞行", - "carpet.rule.safeFlight.desc": "玩家使用鞘翅飞行时不会因为撞到墙壁而受到伤害", - "carpet.rule.weakObsidian.name": "炸毁黑曜石", - "carpet.rule.weakObsidian.desc": "爆炸可以摧毁黑曜石", - "carpet.rule.weakCryingObsidian.name": "炸毁哭泣的黑曜石", - "carpet.rule.weakCryingObsidian.desc": "爆炸可以摧毁哭泣的黑曜石", - "carpet.rule.weakReinforcedDeepslate.name": "炸毁强化深板岩", - "carpet.rule.weakReinforcedDeepslate.desc": "爆炸可以摧毁强化深板岩", - "carpet.rule.weakBedRock.name": "炸毁基岩", - "carpet.rule.weakBedRock.desc": "爆炸可以摧毁基岩", - "carpet.rule.enhancedWorldEater.name": "增强型世界吞噬者", - "carpet.rule.enhancedWorldEater.desc": "爆炸可以摧毁除了铁砧与基岩外的所有方块", - "carpet.rule.infiniteTrades.name": "无限交易", - "carpet.rule.infiniteTrades.desc": "防止村民交易被锁定", - "carpet.rule.invulnerable.name": "无懈可击", - "carpet.rule.invulnerable.desc": "玩家将免受一切伤害", - "carpet.rule.creativeOneHitKill.name": "创造模式一击必杀", - "carpet.rule.creativeOneHitKill.desc": "当玩家在创造模式下时可以做到一击必杀\n当玩家处于潜行状态时,周围的实体也会被杀死", - "carpet.rule.largeEnderChest.name": "大末影箱", - "carpet.rule.largeEnderChest.desc": "让你的末影箱容量增加一倍(与大箱子相同)", - "carpet.rule.bambooModelNoOffset.name": "竹子模型无偏移", - "carpet.rule.bambooModelNoOffset.desc": "让竹子的模型不会产生偏移", - "carpet.rule.bambooCollisionBoxDisabled.name": "禁用竹子碰撞箱", - "carpet.rule.bambooCollisionBoxDisabled.desc": "允许玩家穿过竹子", - "carpet.rule.campfireSmokeParticleDisabled.name": "禁用篝火烟雾粒子", - "carpet.rule.campfireSmokeParticleDisabled.desc": "篝火将不会产生烟雾粒子", - "carpet.rule.antiFireTotem.name": "防火图腾", - "carpet.rule.antiFireTotem.desc": "图腾将不会被火焰或者岩浆烧毁", - "carpet.rule.itemAntiExplosion.name": "掉落物防爆", - "carpet.rule.itemAntiExplosion.desc": "掉落物将不会被爆炸摧毁", - "carpet.rule.creativeShulkerBoxDropsDisable.name": "创造模式潜影盒无掉落", - "carpet.rule.creativeShulkerBoxDropsDisable.desc": "当玩家处于创造模式下时,破坏装有物品的潜影盒也不会产生掉落", - - "carpet.rule.scheduledRandomTickCactus.name": "计划刻催熟仙人掌", - "carpet.rule.scheduledRandomTickCactus.desc": "当仙人掌方块收到计划刻时仍会给予生长随机刻", - "carpet.rule.scheduledRandomTickBamboo.name": "计划刻催熟竹子", - "carpet.rule.scheduledRandomTickBamboo.desc": "当竹子方块收到计划刻时仍会给予生长随机刻", - "carpet.rule.scheduledRandomTickChorusFlower.name": "计划刻催熟紫颂花", - "carpet.rule.scheduledRandomTickChorusFlower.desc": "当紫颂花方块收到计划刻时仍会给予生长随机刻", - "carpet.rule.scheduledRandomTickSugarCane.name": "计划刻催熟甘蔗", - "carpet.rule.scheduledRandomTickSugarCane.desc": "当甘蔗方块收到计划刻时仍会给予生长随机刻", - "carpet.rule.scheduledRandomTickStem.name": "计划刻催熟海带、缠怨藤、垂泪藤", - "carpet.rule.scheduledRandomTickStem.desc": "当海带、缠怨藤、垂泪藤方块收到计划刻时仍会给予生长随机刻", - "carpet.rule.scheduledRandomTickAllPlants.name": "计划刻催熟所有作物", - "carpet.rule.scheduledRandomTickAllPlants.desc": "当所有作物方块收到计划刻时仍会给予生长随机刻", - - "carpet.rule.commandChunkLoading.name": "区块加载控制", - "carpet.rule.commandChunkLoading.desc": "控制任意游戏模式下玩家对周围区块的加载", - "carpet.rule.noteBlockChunkLoader.name": "音符盒区块加载", - "carpet.rule.noteBlockChunkLoader.desc": "音符盒方块被激活时将加载周围3x3区块15s", - "carpet.rule.noteBlockChunkLoader.extra.0": "[bone_block] - 音符盒上方有骨块可以触发加载", - "carpet.rule.noteBlockChunkLoader.extra.1": "[wither_skeleton_skull] - 音符盒上有凋灵骷髅头(可以是挂在墙上的也可以是放在音符盒上的)时可以触发加载", - "carpet.rule.noteBlockChunkLoader.extra.2": "[note_block] - 无需条件,只有音符盒即可加载", - "carpet.rule.noteBlockChunkLoader.extra.3": "[OFF] - 禁用该规则", - "carpet.rule.bellBlockChunkLoader.name": "钟区块加载", - "carpet.rule.bellBlockChunkLoader.desc": "钟方块被激活时将加载周围3x3区块15s", - "carpet.rule.pistonBlockChunkLoader.name": "活塞头区块加载", - "carpet.rule.pistonBlockChunkLoader.desc": "活塞或黏性活塞被激活且能正常伸出时以活塞头将到达的区块为中心加载3x3区块持续15s", - "carpet.rule.pistonBlockChunkLoader.extra.0": "[bone_block] - 当活塞/黏性活塞上方有骨块时", - "carpet.rule.pistonBlockChunkLoader.extra.1": "[bedrock] - 当活塞/黏性活塞下方有基岩时", - "carpet.rule.pistonBlockChunkLoader.extra.2": "[all] - 当活塞/黏性活塞上方有骨块或下方有基岩时", - "carpet.rule.pistonBlockChunkLoader.extra.3": "[OFF] - 禁用该规则", - - "carpet.rule.movableEnderChest.name": "可移动末影箱", - "carpet.rule.movableEnderChest.desc": "让末影箱可以被活塞/黏性活塞推动", - "carpet.rule.movableEndPortalFrame.name": "可移动末地传送门框架", - "carpet.rule.movableEndPortalFrame.desc": "让末地传送门框架可以被活塞/黏性活塞推动", - "carpet.rule.movableObsidian.name": "可移动黑曜石", - "carpet.rule.movableObsidian.desc": "让黑曜石可以被活塞/黏性活塞推动", - "carpet.rule.movableCryingObsidian.name": "可移动哭泣的黑曜石", - "carpet.rule.movableCryingObsidian.desc": "让哭泣的黑曜石可以被活塞/黏性活塞推动", - "carpet.rule.movableBedRock.name": "可移动基岩", - "carpet.rule.movableBedRock.desc": "让基岩可以被活塞/黏性活塞推动", - "carpet.rule.movableEnchantingTable.name": "可移动附魔台", - "carpet.rule.movableEnchantingTable.desc": "让附魔台可以被活塞/黏性活塞推动", - "carpet.rule.movableBeacon.name": "可移动信标", - "carpet.rule.movableBeacon.desc": "让信标可以被活塞/黏性活塞推动", - "carpet.rule.movableReinforcedDeepslate.name": "可移动强化深板岩", - "carpet.rule.movableReinforcedDeepslate.desc": "让强化深板岩可以被活塞/黏性活塞推动", - "carpet.rule.movableAnvil.name": "可移动铁砧", - "carpet.rule.movableAnvil.desc": "让铁砧可以被活塞/黏性活塞推动", - "carpet.rule.movableSculkCatalyst.name": "可移动幽匿催发体", - "carpet.rule.movableSculkCatalyst.desc": "让幽匿催发体可以被活塞/黏性活塞推动", - "carpet.rule.movableSculkSensor.name": "可移动幽匿感测体", - "carpet.rule.movableSculkSensor.desc": "让幽匿感测体可以被活塞/黏性活塞推动", - "carpet.rule.movableSculkShrieker.name": "可移动幽匿尖啸体", - "carpet.rule.movableSculkShrieker.desc": "让幽匿尖啸体可以被活塞/黏性活塞推动", - - "carpet.rule.craftableEnchantedGoldenApples.name": "可合成附魔金苹果", - "carpet.rule.craftableEnchantedGoldenApples.desc": "使用老版本的方式来合成附魔金苹果(8金块+1苹果)", - "carpet.rule.craftableBundle.name": "可合成收纳袋", - "carpet.rule.craftableBundle.desc": "玩家可以在Minecraft 1.17/1.18/1.19中合成收纳袋", - "carpet.rule.craftableSculkSensor.name": "可合成幽匿感测体", - "carpet.rule.craftableSculkSensor.desc": "玩家可以在Minecraft 1.17/1.18中合成幽匿感测体", - "carpet.rule.betterCraftableBoneBlock.name": "更好的骨块合成", - "carpet.rule.betterCraftableBoneBlock.desc": "使用9个骨头可以合成出3个骨块(一点都不卡!)", - "carpet.rule.craftableElytra.name": "可合成鞘翅", - "carpet.rule.craftableElytra.desc": "添加了鞘翅的合成配方", - "carpet.rule.betterCraftableDispenser.name": "更好的合成发射器", - "carpet.rule.betterCraftableDispenser.desc": "使用更灵活的配方来合成发射器", - "carpet.rule.betterCraftablePolishedBlackStoneButton.name": "更好的合成磨制黑石按钮", - "carpet.rule.betterCraftablePolishedBlackStoneButton.desc": "使用深板岩来合成磨制黑石按钮" -} \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/advancements/recipe_rule.json b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/advancements/recipe_rule.json similarity index 92% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/advancements/recipe_rule.json rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/advancements/recipe_rule.json index 869487ef..9d49258d 100644 --- a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/advancements/recipe_rule.json +++ b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/advancements/recipe_rule.json @@ -1,13 +1,13 @@ -{ - "parent": "ams:root", - "criteria": { - "tick": { - "trigger": "minecraft:tick" - } - }, - "rewards": { - "recipes": [ - - ] - } +{ + "parent": "ams:root", + "criteria": { + "tick": { + "trigger": "minecraft:tick" + } + }, + "rewards": { + "recipes": [ + + ] + } } \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/advancements/root.json b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/advancements/root.json similarity index 92% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/advancements/root.json rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/advancements/root.json index 4935812d..bcd9ad46 100644 --- a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/advancements/root.json +++ b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/advancements/root.json @@ -1,7 +1,7 @@ -{ - "criteria": { - "tick": { - "trigger": "minecraft:tick" - } - } +{ + "criteria": { + "tick": { + "trigger": "minecraft:tick" + } + } } \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/bone_block.json b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/bone_block.json similarity index 93% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/bone_block.json rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/bone_block.json index c2492d53..f0c63b5c 100644 --- a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/bone_block.json +++ b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/bone_block.json @@ -1,16 +1,16 @@ -{ - "type": "minecraft:crafting_shaped", - "pattern":[ - "###", - "###", - "###" - ], - "key":{ - "#":{"item":"minecraft:bone" - } - }, - "result":{ - "item":"minecraft:bone_block", - "count":3 - } +{ + "type": "minecraft:crafting_shaped", + "pattern":[ + "###", + "###", + "###" + ], + "key":{ + "#":{"item":"minecraft:bone" + } + }, + "result":{ + "item":"minecraft:bone_block", + "count":3 + } } \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/bundle.json b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/bundle.json similarity index 93% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/bundle.json rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/bundle.json index e5356b41..ac7143a1 100644 --- a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/bundle.json +++ b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/bundle.json @@ -1,18 +1,18 @@ -{ - "type": "minecraft:crafting_shaped", - "pattern":[ - "SRS", - "R R", - "RRR" - ], - "key":{ - "S":{"item":"minecraft:string" - }, - "R":{"item":"minecraft:rabbit_hide" - } - }, - "result":{ - "item":"minecraft:bundle", - "count":1 - } +{ + "type": "minecraft:crafting_shaped", + "pattern":[ + "SRS", + "R R", + "RRR" + ], + "key":{ + "S":{"item":"minecraft:string" + }, + "R":{"item":"minecraft:rabbit_hide" + } + }, + "result":{ + "item":"minecraft:bundle", + "count":1 + } } \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/dispenser1.json b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/dispenser1.json similarity index 100% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/dispenser1.json rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/dispenser1.json diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/dispenser2.json b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/dispenser2.json similarity index 100% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/dispenser2.json rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/dispenser2.json diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/elytra.json b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/elytra.json similarity index 94% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/elytra.json rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/elytra.json index 169c0a7b..feab870c 100644 --- a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/elytra.json +++ b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/elytra.json @@ -1,22 +1,22 @@ -{ - "type": "minecraft:crafting_shaped", - "pattern":[ - "PSP", - "P*P", - "PLP" - ], - "key":{ - "P":{"item":"minecraft:phantom_membrane" - }, - "S":{"item":"minecraft:stick" - }, - "*":{"item":"minecraft:saddle" - }, - "L":{"item":"minecraft:string" - } - }, - "result":{ - "item":"minecraft:elytra", - "count":1 - } +{ + "type": "minecraft:crafting_shaped", + "pattern":[ + "PSP", + "P*P", + "PLP" + ], + "key":{ + "P":{"item":"minecraft:phantom_membrane" + }, + "S":{"item":"minecraft:stick" + }, + "*":{"item":"minecraft:saddle" + }, + "L":{"item":"minecraft:string" + } + }, + "result":{ + "item":"minecraft:elytra", + "count":1 + } } \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/enchanted_golden_apples.json b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/enchanted_golden_apples.json similarity index 94% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/enchanted_golden_apples.json rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/enchanted_golden_apples.json index e4f5a026..0e7ab1f6 100644 --- a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/enchanted_golden_apples.json +++ b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/enchanted_golden_apples.json @@ -1,20 +1,20 @@ -{ - "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "#A#", - "###" - ], - "key": { - "#": { - "item": "minecraft:gold_block" - }, - "A": { - "item": "minecraft:apple" - } - }, - "result": { - "item": "minecraft:enchanted_golden_apple", - "count": 1 - } +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "###", + "#A#", + "###" + ], + "key": { + "#": { + "item": "minecraft:gold_block" + }, + "A": { + "item": "minecraft:apple" + } + }, + "result": { + "item": "minecraft:enchanted_golden_apple", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/polished_blackstone_button.json b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/polished_blackstone_button.json similarity index 100% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/polished_blackstone_button.json rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/polished_blackstone_button.json diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/sculk_sensor.json b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/sculk_sensor.json similarity index 94% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/sculk_sensor.json rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/sculk_sensor.json index d1886e93..12d6a194 100644 --- a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/ams/recipes/sculk_sensor.json +++ b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/ams/recipes/sculk_sensor.json @@ -1,20 +1,20 @@ -{ - "type": "minecraft:crafting_shaped", - "pattern":[ - " ", - "RQR", - "DDD" - ], - "key":{ - "D":{"item":"minecraft:deepslate" - }, - "R":{"item":"minecraft:redstone" - }, - "Q":{"item":"minecraft:quartz" - } - }, - "result":{ - "item":"minecraft:sculk_sensor", - "count":1 - } +{ + "type": "minecraft:crafting_shaped", + "pattern":[ + " ", + "RQR", + "DDD" + ], + "key":{ + "D":{"item":"minecraft:deepslate" + }, + "R":{"item":"minecraft:redstone" + }, + "Q":{"item":"minecraft:quartz" + } + }, + "result":{ + "item":"minecraft:sculk_sensor", + "count":1 + } } \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/pack.mcmeta b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/pack.mcmeta similarity index 95% rename from src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/pack.mcmeta rename to src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/pack.mcmeta index 32034b60..67515842 100644 --- a/src/main/resources/assets/carpet-ams-addition/AmsRecipeTweakPack/pack.mcmeta +++ b/src/main/resources/assets/carpetamsaddition/AmsRecipeTweakPack/pack.mcmeta @@ -1,6 +1,6 @@ -{ - "pack": { - "pack_format": 6, - "description": "Carpet AMS addition recipe tweaking pack" - } +{ + "pack": { + "pack_format": 6, + "description": "Carpet AMS addition recipe tweaking pack" + } } \ No newline at end of file diff --git a/src/main/resources/assets/carpet-ams-addition/icon.png b/src/main/resources/assets/carpetamsaddition/icon.png similarity index 100% rename from src/main/resources/assets/carpet-ams-addition/icon.png rename to src/main/resources/assets/carpetamsaddition/icon.png diff --git a/src/main/resources/assets/carpetamsaddition/lang/en_us.yml b/src/main/resources/assets/carpetamsaddition/lang/en_us.yml new file mode 100644 index 00000000..b7cc477e --- /dev/null +++ b/src/main/resources/assets/carpetamsaddition/lang/en_us.yml @@ -0,0 +1,200 @@ +carpetamsaddition: + + # ------------------------------------------------------ + # Translation below will be passed to fabric carpet + # ------------------------------------------------------ + + carpet_translations: + category: + AMS: AMS + crafting: crafting + AMS_movable: AMS_movable + AMS_chunkLoader: AMS_chunkLoader + + rule: + superBow: + name: superBow + desc: Enabling making super bows with both infinite and mending enchants + sharedVillagerDiscounts: + name: sharedVillagerDiscounts + desc: Share villagers discount to all players + fakePeace: + name: fakePeace + desc: Simulation fake Peace + extinguishedCampfire: + name: extinguishedCampfire + desc: The campfire is extinguished when the player places it + netherWaterPlacement: + name: netherWaterPlacement + desc: Players can use water buckets to place water in nether + softDeepslate: + name: softDeepslate + desc: Change the hardness of deepslate to stone + softObsidian: + name: softObsidian + desc: Change the hardness of obsidian to deepslate + blowUpEverything: + name: blowUpEverything + desc: Set all blocks BlastResistance to 0 + optimizedDragonRespawn: + name: optimizedDragonRespawn + desc: Optimize dragon respawning + safeFlight: + name: safeFlight + desc: players don't get hurt by flying into walls + boneBlockUpdateSuppressor: + name: boneBlockUpdateSuppressor + desc: Let the bone_block be update suppressor + weakObsidian: + name: weakObsidian + desc: Explosion can destroy Obsidian + weakCryingObsidian: + name: weakCryingObsidian + desc: Explosion can destroy crying_obsidian + weakReinforcedDeepslate: + name: weakReinforcedDeepslate + desc: Explosion can destroy ReinforcedDeepslate + weakBedRock: + name: weakBedRock + desc: Explosion can destroy bedrock + enhancedWorldEater: + name: enhancedWorldEater + desc: Explosion can destroy all blocks except anvil and bedrock + infiniteTrades: + name: infiniteTrades + desc: Prevents villager trades from locking up + invulnerable: + name: invulnerable + desc: Players will be protected from all damage except Void Damage + creativeOneHitKill: + name: creativeOneHitKill + desc: Allows players in Creative mode to kill entities in one hit\nIf the player is sneaking, other entities around the target get killed too + largeEnderChest: + name: largeEnderChest + desc: Doubles the size of your EnderChest + bambooModelNoOffset: + name: bambooModelNoOffset + desc: The block model of bamboo will not generate offset + bambooCollisionBoxDisabled: + name: bambooCollisionBoxDisabled + desc: Allow players to pass through bamboo + campfireSmokeParticleDisabled: + name: campfireSmokeParticleDisabled + desc: Disable campfire smoke particles + antiFireTotem: + name: antiFireTotem + desc: Totem will not be destroyed by flames and magma + itemAntiExplosion: + name: itemAntiExplosion + desc: Dropped items will not be destroyed by explosions + +# 计划刻催熟规则: + scheduledRandomTickCactus: + name: scheduledRandomTickCactus + desc: Make cactus accepts scheduled tick as random tick + scheduledRandomTickBamboo: + name: scheduledRandomTickBamboo + desc: Make bamboo accepts scheduled tick as random tick + scheduledRandomTickChorusFlower: + name: scheduledRandomTickChorusFlower + desc: Make chorus flower accepts scheduled tick as random tick + scheduledRandomTickSugarCane: + name: scheduledRandomTickSugarCane + desc: Make sugar cane accepts scheduled tick as random tick + scheduledRandomTickStem: + name: scheduledRandomTickStem + desc: Make stems accepts scheduled tick as random tick + scheduledRandomTickAllPlants: + name: scheduledRandomTickAllPlants + desc: Make all plants accepts scheduled tick as random tick + +#区块加载规则 + commandChunkLoading: + name: commandChunkLoading + desc: Control chunk loading for players at any gamemodes + noteBlockChunkLoader: + name: noteBlockChunkLoader + desc: Load nearby 3x3 chunks for 15 seconds when a note block is triggered + extra: + '0': bone_block When bone_block is on the note_block + '1': bedrock When wither_skeleton_skull is on the note_block, either placed on the note block or hanging on the wall + '2': all Only note_block + '3': OFF Disable the rule + bellBlockChunkLoader: + name: bellBlockChunkLoader + desc: Load nearby 3x3 chunks for 15 seconds when a bell is triggered + pistonBlockChunkLoader: + name: pistonBlockChunkLoader + desc: Load nearby 3x3 chunks for 15 seconds when a piston is triggered (Centered on the piston head) + extra: + '0': bone_block When bone_block is on the piston + '1': bedrock When bedrock is under the piston + '2': all When bone_block is on the piston or bedrock is under the piston + '3': OFF Disable the rule + creativeShulkerBoxDropsDisable: + name: creativeShulkerBoxDropsDisable + desc: Breaking a shulker box with items in creative mode will not cause drops + +#可移动方块规则 + movableEnderChest: + name: movableEnderChest + desc: Makes ender_chests movable + movableEndPortalFrame: + name: movableEndPortalFrame + desc: Makes end_portal_frame movable + movableObsidian: + name: movableObsidian + desc: Makes obsidian movable + movableCryingObsidian: + name: movableCryingObsidian + desc: Makes crying_obsidian movable + movableBedRock: + name: movableBedRock + desc: Makes bedrock movable + movableEnchantingTable: + name: movableEnchantingTable + desc: Makes enchanting_table movable + movableBeacon: + name: movableBeacon + desc: Makes beacon movable + movableReinforcedDeepslate: + name: movableReinforcedDeepslate + desc: Makes reinforced_deepslate movable + movableAnvil: + name: movableAnvil + desc: Makes anvil movable + movableSculkCatalyst: + name: movableAnvil + desc: Makes sculk_catalyst movable + movableSculkSensor: + name: movableSculkSensor + desc: Makes sculk_sensor movable + movableSculkShrieker: + name: movableCalibratedSculkSensor + desc: Makes sculk_shrieker + movableCalibratedSculkSensor: + name: movableCalibratedSculkSensor + desc: Makes calibrated_sculk_sensor movableSculkShrieker + +#合成配方规则 + craftableEnchantedGoldenApples: + name: craftableEnchantedGoldenApples + desc: Enchanted Golden Apples can be crafted with 8 Gold Blocks again + craftableBundle: + name: craftableBundle + desc: Crafted bundle in minecraft 1.17/1.18/1.19 + craftableSculkSensor: + name: craftableSculkSensor + desc: Crafted sculk_sensor in minecraft 1.17/1.18 + betterCraftableBoneBlock: + name: betterCraftableBoneBlock + desc: Use nine bones to crafted three bone_blocks + craftableElytra: + name: craftableElytra + desc: Add elytra recipes in minecraft + betterCraftableDispenser: + name: betterCraftableDispenser + desc: Better craftable dispenser + betterCraftablePolishedBlackStoneButton: + name: betterCraftablePolishedBlackStoneButton + desc: Use deepslate to crafted polished_blackstone_button in minecraft \ No newline at end of file diff --git a/src/main/resources/assets/carpetamsaddition/lang/meta/languages.yml b/src/main/resources/assets/carpetamsaddition/lang/meta/languages.yml new file mode 100644 index 00000000..c72d62ec --- /dev/null +++ b/src/main/resources/assets/carpetamsaddition/lang/meta/languages.yml @@ -0,0 +1,3 @@ +languages: + - en_us + - zh_cn diff --git a/src/main/resources/assets/carpetamsaddition/lang/zh_cn.yml b/src/main/resources/assets/carpetamsaddition/lang/zh_cn.yml new file mode 100644 index 00000000..b7d6cdcd --- /dev/null +++ b/src/main/resources/assets/carpetamsaddition/lang/zh_cn.yml @@ -0,0 +1,200 @@ +carpetamsaddition: + + # ------------------------------------------------------ + # Translation below will be passed to fabric carpet + # ------------------------------------------------------ + + carpet_translations: + category: + AMS: AMS + crafting: 制造 + AMS_movable: AMS_可移动方块 + AMS_chunkLoader: AMS_区块加载 + + rule: + superBow: + name: 超级弓 + desc: 让弓能同时打上无限和经验修补两种附魔 + sharedVillagerDiscounts: + name: 共享打折 + desc: 玩家将僵尸村民治疗为村民后的获得的折扣将共享给所有玩家 + fakePeace: + name: 伪和平 + desc: 伪和平 + extinguishedCampfire: + name: 熄灭的篝火 + desc: 当玩家放置篝火时,篝火处于熄灭状态 + netherWaterPlacement: + name: 地狱可放水 + desc: 玩家可以在地狱使用水桶放置水 + softDeepslate: + name: 易碎深板岩 + desc: 改变深板岩的硬度使其和普通石头一致 + softObsidian: + name: 易碎黑曜石 + desc: 改变黑曜石的硬度使其和深板岩一致 + blowUpEverything: + name: 炸毁所有方块 + desc: 让所有方块的爆炸抗性为0 + optimizedDragonRespawn: + name: 龙战优化 + desc: 大幅度优化龙战定位末地门过程,为基于末地门的末地石农场设计 + safeFlight: + name: 安全飞行 + desc: 玩家使用鞘翅飞行时不会因为撞到墙壁而受到伤害 + boneBlockUpdateSuppressor: + name: 骨块更新抑制器 + desc: 让骨块成为一个更新抑制器 + weakObsidian: + name: 炸毁黑曜石 + desc: 爆炸可以摧毁黑曜石 + weakCryingObsidian: + name: 炸毁哭泣的黑曜石 + desc: 爆炸可以摧毁哭泣的黑曜石 + weakReinforcedDeepslate: + name: 炸毁强化深板岩 + desc: 爆炸可以摧毁强化深板岩 + weakBedRock: + name: 炸毁基岩 + desc: 爆炸可以摧毁基岩 + enhancedWorldEater: + name: 增强型世界吞噬者 + desc: 爆炸可以摧毁除了铁砧与基岩外的所有方块 + infiniteTrades: + name: 无限交易 + desc: 防止村民交易被锁定 + invulnerable: + name: 无懈可击 + desc: 玩家将免受除虚空伤害外的一切伤害 + creativeOneHitKill: + name: 创造模式一击必杀 + desc: 当玩家在创造模式下时可以做到一击必杀\n当玩家处于潜行状态时,周围的实体也会被杀死 + largeEnderChest: + name: 大末影箱 + desc: 让你的末影箱容量增加一倍(与大箱子相同) + bambooModelNoOffset: + name: 竹子模型无偏移 + desc: 让竹子的模型不会产生偏移 + bambooCollisionBoxDisabled: + name: 禁用竹子碰撞箱 + desc: 允许玩家穿过竹子 + campfireSmokeParticleDisabled: + name: 禁用篝火烟雾粒子 + desc: 篝火将不会产生烟雾粒子 + antiFireTotem: + name: 防火图腾 + desc: 图腾将不会被火焰或者岩浆烧毁 + itemAntiExplosion: + name: 掉落物防爆 + desc: 掉落物将不会被爆炸摧毁 + creativeShulkerBoxDropsDisable: + name: 创造模式潜影盒无掉落 + desc: 当玩家处于创造模式下时,破坏装有物品的潜影盒也不会产生掉落 + +# 计划刻催熟规则: + scheduledRandomTickCactus: + name: 计划刻催熟仙人掌 + desc: 当仙人掌方块收到计划刻时仍会给予生长随机刻 + scheduledRandomTickBamboo: + name: 计划刻催熟竹子 + desc: 当竹子方块收到计划刻时仍会给予生长随机刻 + scheduledRandomTickChorusFlower: + name: 计划刻催熟紫颂花 + desc: 当紫颂花方块收到计划刻时仍会给予生长随机刻 + scheduledRandomTickSugarCane: + name: 计划刻催熟甘蔗 + desc: 当甘蔗方块收到计划刻时仍会给予生长随机刻 + scheduledRandomTickStem: + name: 计划刻催熟海带、缠怨藤、垂泪藤 + desc: 当海带、缠怨藤、垂泪藤方块收到计划刻时仍会给予生长随机刻 + scheduledRandomTickAllPlants: + name: 计划刻催熟所有作物 + desc: 当所有作物方块收到计划刻时仍会给予生长随机刻 + +#区块加载规则 + commandChunkLoading: + name: 区块加载控制 + desc: 控制任意游戏模式下玩家对周围区块的加载 + noteBlockChunkLoader: + name: 音符盒区块加载 + desc: 音符盒方块被激活时将加载周围3x3区块15s + extra: + '0': bone_block 音符盒上方有骨块可以触发加载 + '1': wither_skeleton_skull 音符盒上有凋灵骷髅头(可以是挂在墙上的也可以是放在音符盒上的)时可以触发加载 + '2': note_block 无需条件,只有音符盒即可加载 + '3': OFF 禁用该规则 + bellBlockChunkLoader: + name: 钟区块加载 + desc: 钟方块被激活时将加载周围3x3区块15s + pistonBlockChunkLoader: + name: 活塞头区块加载 + desc: 活塞或黏性活塞被激活且能正常伸出时以活塞头将到达的区块为中心加载3x3区块持续15s + extra: + '0': bone_block 当活塞/黏性活塞上方有骨块时 + '1': bedrock 当活塞/黏性活塞下方有基岩时 + '2': all 当活塞/黏性活塞上方有骨块或下方有基岩时 + '3': OFF 禁用该规则 + +#可移动方块规则 + movableEnderChest: + name: 可移动末影箱 + desc: 让末影箱可以被活塞/黏性活塞推动 + movableEndPortalFrame: + name: 可移动末地传送门框架 + desc: 让末地传送门框架可以被活塞/黏性活塞推动 + movableObsidian: + name: 可移动黑曜石 + desc: 让黑曜石可以被活塞/黏性活塞推动 + movableCryingObsidian: + name: 可移动哭泣的黑曜石 + desc: 让哭泣的黑曜石可以被活塞/黏性活塞推动 + movableBedRock: + name: 可移动基岩 + desc: 让基岩可以被活塞/黏性活塞推动 + movableEnchantingTable: + name: 可移动附魔台 + desc: 让附魔台可以被活塞/黏性活塞推动 + movableBeacon: + name: 可移动信标 + desc: 让信标可以被活塞/黏性活塞推动 + movableReinforcedDeepslate: + name: 可移动强化深板岩 + desc: 让强化深板岩可以被活塞/黏性活塞推动 + movableAnvil: + name: 可移动铁砧 + desc: 让铁砧可以被活塞/黏性活塞推动 + movableSculkCatalyst: + name: 可移动幽匿催发体 + desc: 让幽匿催发体可以被活塞/黏性活塞推动 + movableSculkSensor: + name: 可移动幽匿感测体 + desc: 让幽匿感测体可以被活塞/黏性活塞推动 + movableSculkShrieker: + name: 可移动幽匿尖啸体 + desc: 让幽匿尖啸体可以被活塞/黏性活塞推动 + movableCalibratedSculkSensor: + name: 可移动校频幽匿感测体 + desc: 让校频幽匿感测体可以被活塞/黏性活塞推动 + +#合成配方规则 + craftableEnchantedGoldenApples: + name: 可合成附魔金苹果 + desc: 使用老版本的方式来合成附魔金苹果(8金块+1苹果) + craftableBundle: + name: 可合成收纳袋 + desc: 玩家可以在Minecraft 1.17/1.18/1.19中合成收纳袋 + craftableSculkSensor: + name: 可合成幽匿感测体 + desc: 玩家可以在Minecraft 1.17/1.18中合成幽匿感测体 + betterCraftableBoneBlock: + name: 更好的骨块合成 + desc: 使用9个骨头可以合成出3个骨块(一点都不卡!) + craftableElytra: + name: 可合成鞘翅 + desc: 添加了鞘翅的合成配方 + betterCraftableDispenser: + name: 更好的合成发射器 + desc: 使用更灵活的配方来合成发射器 + betterCraftablePolishedBlackStoneButton: + name: 更好的合成磨制黑石按钮 + desc: 使用深板岩来合成磨制黑石按钮 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 223d9aed..167593c8 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -6,14 +6,15 @@ "description": "一个简陋的,东拼西凑的,及其不原版的Carpet拓展。", "authors": [ "1024_byteeeee", - "WenDavid" + "WenDavid", + "···" ], "contact": { "homepage": "https://mcams.club/", "sources": "https://mcams.club/" }, "license": "LGPL-3.0", - "icon": "assets/carpet-ams-addition/icon.png", + "icon": "assets/carpetamsaddition/icon.png", "environment": "*", "entrypoints": { "main": [