From 94bf712e10e3673306cd2251daa46b209cc5f8a5 Mon Sep 17 00:00:00 2001 From: TheDrawingCoding-Gamer Date: Wed, 29 Jan 2025 18:03:59 -0500 Subject: [PATCH] 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();