Skip to content

Commit

Permalink
Config option for Greater Teleport item splatting (FallingColors#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
object-Object authored Feb 4, 2025
2 parents 7233cc1 + 72293dc commit ef2cd28
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ public static final class Server implements HexConfig.ServerConfigAccess, Config
@ConfigEntry.Gui.Tooltip
private List<String> 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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ public static class Server implements HexConfig.ServerConfigAccess {
private static ForgeConfigSpec.IntValue maxSpellCircleLength;
private static ForgeConfigSpec.ConfigValue<List<? extends String>> actionDenyList;
private static ForgeConfigSpec.ConfigValue<List<? extends String>> circleActionDenyList;

private static ForgeConfigSpec.BooleanValue greaterTeleportSplatsItems;
private static ForgeConfigSpec.BooleanValue villagersOffendedByMindMurder;
private static ForgeConfigSpec.ConfigValue<List<? extends String>> tpDimDenyList;
private static ForgeConfigSpec.BooleanValue doesTrueNameHaveAmbit;
Expand Down Expand Up @@ -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 items fly out of the player's inventory when using Greater Teleport?"
).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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ef2cd28

Please sign in to comment.