From 94bf712e10e3673306cd2251daa46b209cc5f8a5 Mon Sep 17 00:00:00 2001 From: TheDrawingCoding-Gamer Date: Wed, 29 Jan 2025 18:03:59 -0500 Subject: [PATCH 1/3] base config option for greater teleport splating --- .../java/at/petrak/hexcasting/api/mod/HexConfig.java | 3 +++ .../common/casting/actions/spells/great/OpTeleport.kt | 2 +- .../at/petrak/hexcasting/fabric/FabricHexConfig.java | 5 +++++ .../java/at/petrak/hexcasting/forge/ForgeHexConfig.java | 9 +++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java index b6e6d952b..0bcc5a7fa 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java @@ -67,6 +67,8 @@ public interface ServerConfigAccess { boolean isActionAllowedInCircles(ResourceLocation actionID); + boolean doesGreaterTeleportSplatItems(); + boolean doVillagersTakeOffenseAtMindMurder(); // fun fact, although dimension keys are a RegistryHolder, they aren't a registry, so i can't do tags @@ -81,6 +83,7 @@ public interface ServerConfigAccess { int DEFAULT_OP_BREAK_HARVEST_LEVEL = 3; double DEFAULT_TRADER_SCROLL_CHANCE = 0.2; + boolean DEFAULT_GREATER_TELEPORT_SPLATS_ITEMS = true; boolean DEFAULT_VILLAGERS_DISLIKE_MIND_MURDER = true; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/great/OpTeleport.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/great/OpTeleport.kt index abd39e52e..c349aa0bb 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/great/OpTeleport.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/great/OpTeleport.kt @@ -62,7 +62,7 @@ object OpTeleport : SpellAction { teleportRespectSticky(teleportee, delta, env.world) - if (teleportee is ServerPlayer && teleportee == env.castingEntity) { + if (HexConfig.server().doesGreaterTeleportSplatItems() && teleportee is ServerPlayer && teleportee == env.castingEntity) { // Drop items conditionally, based on distance teleported. // MOST IMPORTANT: Never drop main hand item, since if it's a trinket, it will get duplicated later. diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java index c4d365cb1..a0ff01d31 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java @@ -182,6 +182,8 @@ public static final class Server implements HexConfig.ServerConfigAccess, Config @ConfigEntry.Gui.Tooltip private List circleActionDenyList = List.of(); @ConfigEntry.Gui.Tooltip + private boolean greaterTeleportSplatsItems = DEFAULT_GREATER_TELEPORT_SPLATS_ITEMS; + @ConfigEntry.Gui.Tooltip private boolean villagersOffendedByMindMurder = DEFAULT_VILLAGERS_DISLIKE_MIND_MURDER; @ConfigEntry.Gui.Tooltip private boolean doesTrueNameHaveAmbit = DEFAULT_TRUE_NAME_HAS_AMBIT; @@ -291,6 +293,9 @@ public boolean isActionAllowedInCircles(ResourceLocation actionID) { return noneMatch(circleActionDenyList, actionID); } + @Override + public boolean doesGreaterTeleportSplatItems() { return greaterTeleportSplatsItems; } + @Override public boolean doVillagersTakeOffenseAtMindMurder() { return villagersOffendedByMindMurder; diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java index bacdece12..121229bcf 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java @@ -137,6 +137,8 @@ public static class Server implements HexConfig.ServerConfigAccess { private static ForgeConfigSpec.IntValue maxSpellCircleLength; private static ForgeConfigSpec.ConfigValue> actionDenyList; private static ForgeConfigSpec.ConfigValue> circleActionDenyList; + + private static ForgeConfigSpec.BooleanValue greaterTeleportSplatsItems; private static ForgeConfigSpec.BooleanValue villagersOffendedByMindMurder; private static ForgeConfigSpec.ConfigValue> tpDimDenyList; private static ForgeConfigSpec.BooleanValue doesTrueNameHaveAmbit; @@ -176,6 +178,10 @@ public Server(ForgeConfigSpec.Builder builder) { "Resource locations of disallowed actions. Trying to cast one of these will result in a mishap.") .defineList("actionDenyList", List.of(), Server::isValidReslocArg); + greaterTeleportSplatsItems = builder.comment( + "Should greater teleport splat players inventory?" + ).define("greaterTeleportSplatsItems", DEFAULT_GREATER_TELEPORT_SPLATS_ITEMS); + villagersOffendedByMindMurder = builder.comment( "Should villagers take offense when you flay the mind of their fellow villagers?") .define("villagersOffendedByMindMurder", true); @@ -213,6 +219,9 @@ public boolean isActionAllowedInCircles(ResourceLocation actionID) { return noneMatch(circleActionDenyList.get(), actionID); } + @Override + public boolean doesGreaterTeleportSplatItems() { return greaterTeleportSplatsItems.get(); } + @Override public boolean doVillagersTakeOffenseAtMindMurder() { return villagersOffendedByMindMurder.get(); From 0e20a38cc838c2753c6201326f73042465a445ff Mon Sep 17 00:00:00 2001 From: TheDrawingCoding-Gamer Date: Wed, 29 Jan 2025 18:13:19 -0500 Subject: [PATCH 2/3] Add lang string for greater teleport splat option --- .../main/resources/assets/hexcasting/lang/en_us.flatten.json5 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 index af284b7a6..86c043ce3 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 @@ -373,6 +373,10 @@ "": "Circle Action Deny List", "@Tooltip": "Resource locations of disallowed actions within circles. Trying to cast one of these from a circle will result in a mishap.", }, + greaterTeleportSplatsItems: { + "": "Greater Teleport Splats Items", + "@Tooltip": "Whether items should fly out of the player's inventory when using Greater Teleport" + }, villagersOffendedByMindMurder: { "": "Villagers Offended By Mind Murder", "@Tooltip": "Whether villagers should be angry at the player when other villagers are mindflayed", From 72293dc810d23d01c6df2ec3d56d2971ed6d6fff Mon Sep 17 00:00:00 2001 From: TheDrawingCoding-Gamer Date: Mon, 3 Feb 2025 19:31:09 -0500 Subject: [PATCH 3/3] Edit wording on forge comment --- .../main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java index 121229bcf..518a81a2e 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java @@ -179,7 +179,7 @@ public Server(ForgeConfigSpec.Builder builder) { .defineList("actionDenyList", List.of(), Server::isValidReslocArg); greaterTeleportSplatsItems = builder.comment( - "Should greater teleport splat players inventory?" + "Should items fly out of the player's inventory when using Greater Teleport?" ).define("greaterTeleportSplatsItems", DEFAULT_GREATER_TELEPORT_SPLATS_ITEMS); villagersOffendedByMindMurder = builder.comment(