Skip to content

Commit ef2cd28

Browse files
Config option for Greater Teleport item splatting (#841)
2 parents 7233cc1 + 72293dc commit ef2cd28

File tree

5 files changed

+22
-1
lines changed

5 files changed

+22
-1
lines changed

Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ public interface ServerConfigAccess {
6767

6868
boolean isActionAllowedInCircles(ResourceLocation actionID);
6969

70+
boolean doesGreaterTeleportSplatItems();
71+
7072
boolean doVillagersTakeOffenseAtMindMurder();
7173

7274
// 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 {
8183
int DEFAULT_OP_BREAK_HARVEST_LEVEL = 3;
8284

8385
double DEFAULT_TRADER_SCROLL_CHANCE = 0.2;
86+
boolean DEFAULT_GREATER_TELEPORT_SPLATS_ITEMS = true;
8487

8588
boolean DEFAULT_VILLAGERS_DISLIKE_MIND_MURDER = true;
8689

Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/great/OpTeleport.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object OpTeleport : SpellAction {
6262

6363
teleportRespectSticky(teleportee, delta, env.world)
6464

65-
if (teleportee is ServerPlayer && teleportee == env.castingEntity) {
65+
if (HexConfig.server().doesGreaterTeleportSplatItems() && teleportee is ServerPlayer && teleportee == env.castingEntity) {
6666
// Drop items conditionally, based on distance teleported.
6767
// MOST IMPORTANT: Never drop main hand item, since if it's a trinket, it will get duplicated later.
6868

Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@
373373
"": "Circle Action Deny List",
374374
"@Tooltip": "Resource locations of disallowed actions within circles. Trying to cast one of these from a circle will result in a mishap.",
375375
},
376+
greaterTeleportSplatsItems: {
377+
"": "Greater Teleport Splats Items",
378+
"@Tooltip": "Whether items should fly out of the player's inventory when using Greater Teleport"
379+
},
376380
villagersOffendedByMindMurder: {
377381
"": "Villagers Offended By Mind Murder",
378382
"@Tooltip": "Whether villagers should be angry at the player when other villagers are mindflayed",

Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ public static final class Server implements HexConfig.ServerConfigAccess, Config
182182
@ConfigEntry.Gui.Tooltip
183183
private List<String> circleActionDenyList = List.of();
184184
@ConfigEntry.Gui.Tooltip
185+
private boolean greaterTeleportSplatsItems = DEFAULT_GREATER_TELEPORT_SPLATS_ITEMS;
186+
@ConfigEntry.Gui.Tooltip
185187
private boolean villagersOffendedByMindMurder = DEFAULT_VILLAGERS_DISLIKE_MIND_MURDER;
186188
@ConfigEntry.Gui.Tooltip
187189
private boolean doesTrueNameHaveAmbit = DEFAULT_TRUE_NAME_HAS_AMBIT;
@@ -291,6 +293,9 @@ public boolean isActionAllowedInCircles(ResourceLocation actionID) {
291293
return noneMatch(circleActionDenyList, actionID);
292294
}
293295

296+
@Override
297+
public boolean doesGreaterTeleportSplatItems() { return greaterTeleportSplatsItems; }
298+
294299
@Override
295300
public boolean doVillagersTakeOffenseAtMindMurder() {
296301
return villagersOffendedByMindMurder;

Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ public static class Server implements HexConfig.ServerConfigAccess {
137137
private static ForgeConfigSpec.IntValue maxSpellCircleLength;
138138
private static ForgeConfigSpec.ConfigValue<List<? extends String>> actionDenyList;
139139
private static ForgeConfigSpec.ConfigValue<List<? extends String>> circleActionDenyList;
140+
141+
private static ForgeConfigSpec.BooleanValue greaterTeleportSplatsItems;
140142
private static ForgeConfigSpec.BooleanValue villagersOffendedByMindMurder;
141143
private static ForgeConfigSpec.ConfigValue<List<? extends String>> tpDimDenyList;
142144
private static ForgeConfigSpec.BooleanValue doesTrueNameHaveAmbit;
@@ -176,6 +178,10 @@ public Server(ForgeConfigSpec.Builder builder) {
176178
"Resource locations of disallowed actions. Trying to cast one of these will result in a mishap.")
177179
.defineList("actionDenyList", List.of(), Server::isValidReslocArg);
178180

181+
greaterTeleportSplatsItems = builder.comment(
182+
"Should items fly out of the player's inventory when using Greater Teleport?"
183+
).define("greaterTeleportSplatsItems", DEFAULT_GREATER_TELEPORT_SPLATS_ITEMS);
184+
179185
villagersOffendedByMindMurder = builder.comment(
180186
"Should villagers take offense when you flay the mind of their fellow villagers?")
181187
.define("villagersOffendedByMindMurder", true);
@@ -213,6 +219,9 @@ public boolean isActionAllowedInCircles(ResourceLocation actionID) {
213219
return noneMatch(circleActionDenyList.get(), actionID);
214220
}
215221

222+
@Override
223+
public boolean doesGreaterTeleportSplatItems() { return greaterTeleportSplatsItems.get(); }
224+
216225
@Override
217226
public boolean doVillagersTakeOffenseAtMindMurder() {
218227
return villagersOffendedByMindMurder.get();

0 commit comments

Comments
 (0)