centralize all ModConfig.SERVER reads through SettingsAccessor
No more direct ModConfig.SERVER access outside SettingsAccessor. 32 new accessor methods, 21 consumer files rerouted.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.tiedup.remake.entities;
|
||||
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.dialogue.EntityDialogueManager;
|
||||
import java.util.UUID;
|
||||
@@ -179,7 +179,7 @@ public class DamselRewardTracker {
|
||||
// Thank the savior via dialogue
|
||||
damsel.talkToPlayersInRadius(
|
||||
EntityDialogueManager.DialogueCategory.DAMSEL_FREED,
|
||||
ModConfig.SERVER.dialogueRadius.get()
|
||||
SettingsAccessor.getDialogueRadius()
|
||||
);
|
||||
|
||||
TiedUpMod.LOGGER.info(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.tiedup.remake.entities;
|
||||
|
||||
import com.tiedup.remake.blocks.entity.KidnapBombBlockEntity;
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.util.KidnapExplosion;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -56,7 +55,7 @@ public class EntityKidnapBomb extends PrimedTnt {
|
||||
this.setPos(x, y, z);
|
||||
double d0 = level.random.nextDouble() * (Math.PI * 2);
|
||||
this.setDeltaMovement(-Math.sin(d0) * 0.02, 0.2, -Math.cos(d0) * 0.02);
|
||||
this.setFuse(ModConfig.SERVER.kidnapBombFuse.get());
|
||||
this.setFuse(SettingsAccessor.getKidnapBombFuse());
|
||||
|
||||
this.xo = x;
|
||||
this.yo = y;
|
||||
|
||||
@@ -335,9 +335,9 @@ public class EntityKidnapperArcher
|
||||
public int getBindChanceForTarget(UUID targetUUID) {
|
||||
int hitCount = targetHitCounts.getOrDefault(targetUUID, 0);
|
||||
int baseChance =
|
||||
com.tiedup.remake.core.ModConfig.SERVER.archerArrowBindChanceBase.get();
|
||||
SettingsAccessor.getArcherArrowBindChanceBase();
|
||||
int perHitChance =
|
||||
com.tiedup.remake.core.ModConfig.SERVER.archerArrowBindChancePerHit.get();
|
||||
SettingsAccessor.getArcherArrowBindChancePerHit();
|
||||
|
||||
int chance = baseChance + (hitCount * perHitChance);
|
||||
return Math.min(chance, ARCHER_MAX_BIND_CHANCE);
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.tiedup.remake.entities;
|
||||
|
||||
import static com.tiedup.remake.util.GameConstants.*;
|
||||
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.dialogue.SpeakerType;
|
||||
@@ -356,7 +355,7 @@ public class EntityKidnapperMerchant extends EntityKidnapperElite {
|
||||
private void transitionToHostile(LivingEntity attacker) {
|
||||
currentState = MerchantState.HOSTILE;
|
||||
attackerUUID = attacker.getUUID();
|
||||
hostileCooldownTicks = ModConfig.SERVER.merchantHostileDuration.get();
|
||||
hostileCooldownTicks = SettingsAccessor.getMerchantHostileDuration();
|
||||
entityData.set(DATA_MERCHANT_STATE, MerchantState.HOSTILE.getId());
|
||||
|
||||
// Equip kidnapper items
|
||||
@@ -536,8 +535,8 @@ public class EntityKidnapperMerchant extends EntityKidnapperElite {
|
||||
addGuaranteedUtilities();
|
||||
|
||||
// RANDOM TRADES
|
||||
int min = ModConfig.SERVER.merchantMinTrades.get();
|
||||
int max = ModConfig.SERVER.merchantMaxTrades.get();
|
||||
int min = SettingsAccessor.getMerchantMinTrades();
|
||||
int max = SettingsAccessor.getMerchantMaxTrades();
|
||||
int count = min + this.random.nextInt(Math.max(1, max - min + 1));
|
||||
|
||||
// Collect all mod items
|
||||
@@ -644,21 +643,21 @@ public class EntityKidnapperMerchant extends EntityKidnapperElite {
|
||||
int minPrice, maxPrice;
|
||||
switch (tier) {
|
||||
case 4:
|
||||
minPrice = ModConfig.SERVER.tier4PriceMin.get();
|
||||
maxPrice = ModConfig.SERVER.tier4PriceMax.get();
|
||||
minPrice = SettingsAccessor.getTier4PriceMin();
|
||||
maxPrice = SettingsAccessor.getTier4PriceMax();
|
||||
break;
|
||||
case 3:
|
||||
minPrice = ModConfig.SERVER.tier3PriceMin.get();
|
||||
maxPrice = ModConfig.SERVER.tier3PriceMax.get();
|
||||
minPrice = SettingsAccessor.getTier3PriceMin();
|
||||
maxPrice = SettingsAccessor.getTier3PriceMax();
|
||||
break;
|
||||
case 2:
|
||||
minPrice = ModConfig.SERVER.tier2PriceMin.get();
|
||||
maxPrice = ModConfig.SERVER.tier2PriceMax.get();
|
||||
minPrice = SettingsAccessor.getTier2PriceMin();
|
||||
maxPrice = SettingsAccessor.getTier2PriceMax();
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
minPrice = ModConfig.SERVER.tier1PriceMin.get();
|
||||
maxPrice = ModConfig.SERVER.tier1PriceMax.get();
|
||||
minPrice = SettingsAccessor.getTier1PriceMin();
|
||||
maxPrice = SettingsAccessor.getTier1PriceMax();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.tiedup.remake.entities;
|
||||
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.items.ModItems;
|
||||
import com.tiedup.remake.state.IBondageState;
|
||||
@@ -87,7 +87,7 @@ public class EntityRopeArrow extends AbstractArrow {
|
||||
bindChance = archer.getBindChanceForTarget(target.getUUID());
|
||||
} else {
|
||||
// Other shooters: default 50% chance
|
||||
bindChance = ModConfig.SERVER.ropeArrowBindChance.get();
|
||||
bindChance = SettingsAccessor.getRopeArrowBindChance();
|
||||
}
|
||||
|
||||
// Roll for bind chance
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.tiedup.remake.entities.ai.kidnapper;
|
||||
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.dialogue.EntityDialogueManager;
|
||||
import com.tiedup.remake.dialogue.EntityDialogueManager.DialogueCategory;
|
||||
@@ -155,7 +155,7 @@ public class KidnapperWaitForBuyerGoal extends Goal {
|
||||
|
||||
// Check if Master should spawn immediately for solo player
|
||||
IRestrainable captive = this.kidnapper.getCaptive();
|
||||
boolean isMasterEnabled = ModConfig.SERVER.enableMasterSpawn.get();
|
||||
boolean isMasterEnabled = SettingsAccessor.isEnableMasterSpawn();
|
||||
boolean isPlayer =
|
||||
captive != null && captive.asLivingEntity() instanceof Player;
|
||||
|
||||
@@ -171,12 +171,12 @@ public class KidnapperWaitForBuyerGoal extends Goal {
|
||||
// Don't return - let the goal continue so kidnapper waits for Master
|
||||
// The wait duration is set to allow Master to arrive
|
||||
this.waitDuration = 6000; // 5 minutes max wait for Master to arrive
|
||||
} else if (this.soloMode && ModConfig.SERVER.enableSoloFallback.get()) {
|
||||
} else if (this.soloMode && SettingsAccessor.isEnableSoloFallback()) {
|
||||
// Solo mode (non-player captive): use config timeout
|
||||
this.waitDuration = ModConfig.SERVER.soloTimeoutSeconds.get() * 20;
|
||||
this.waitDuration = SettingsAccessor.getSoloTimeoutSeconds() * 20;
|
||||
TiedUpMod.LOGGER.debug(
|
||||
"[KidnapperWaitForBuyerGoal] Solo mode detected, using {}s timeout",
|
||||
ModConfig.SERVER.soloTimeoutSeconds.get()
|
||||
SettingsAccessor.getSoloTimeoutSeconds()
|
||||
);
|
||||
} else {
|
||||
// Normal mode: random 5-8 minutes
|
||||
@@ -426,7 +426,7 @@ public class KidnapperWaitForBuyerGoal extends Goal {
|
||||
}
|
||||
|
||||
// Handle solo mode fallback
|
||||
if (this.soloMode && ModConfig.SERVER.enableSoloFallback.get()) {
|
||||
if (this.soloMode && SettingsAccessor.isEnableSoloFallback()) {
|
||||
handleSoloModeFallback(captive);
|
||||
} else {
|
||||
// Normal multiplayer mode: just flee
|
||||
@@ -450,7 +450,7 @@ public class KidnapperWaitForBuyerGoal extends Goal {
|
||||
}
|
||||
|
||||
// Check if Master spawn is enabled and captive is a player
|
||||
boolean isMasterEnabled = ModConfig.SERVER.enableMasterSpawn.get();
|
||||
boolean isMasterEnabled = SettingsAccessor.isEnableMasterSpawn();
|
||||
boolean isPlayer = captive.asLivingEntity() instanceof Player;
|
||||
|
||||
if (isMasterEnabled && isPlayer) {
|
||||
@@ -460,7 +460,7 @@ public class KidnapperWaitForBuyerGoal extends Goal {
|
||||
}
|
||||
|
||||
// Fallback to original behavior
|
||||
double keepChance = ModConfig.SERVER.soloKeepChance.get();
|
||||
double keepChance = SettingsAccessor.getSoloKeepChance();
|
||||
double roll = this.kidnapper.getRandom().nextDouble();
|
||||
|
||||
TiedUpMod.LOGGER.debug(
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.tiedup.remake.entities.ai.maid.goals;
|
||||
|
||||
import com.tiedup.remake.cells.CellDataV2;
|
||||
import com.tiedup.remake.cells.CellRegistryV2;
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.entities.EntityMaid;
|
||||
import com.tiedup.remake.labor.LaborTask;
|
||||
@@ -87,7 +87,7 @@ public class MaidAssignTaskGoal extends Goal {
|
||||
|
||||
if (phase == LaborRecord.WorkPhase.RESTING) {
|
||||
// Check if rest is complete (config: laborRestSeconds, default 120s)
|
||||
long restTicks = ModConfig.SERVER.laborRestSeconds.get() * 20L;
|
||||
long restTicks = SettingsAccessor.getLaborRestSeconds() * 20L;
|
||||
long elapsed = labor.getTimeInPhase(currentTime);
|
||||
if (elapsed >= restTicks) {
|
||||
labor.finishRest(currentTime);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.tiedup.remake.entities.damsel.components;
|
||||
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.entities.EntityDamsel;
|
||||
import com.tiedup.remake.entities.ai.damsel.*;
|
||||
@@ -223,7 +223,7 @@ public class DamselAIController {
|
||||
Player.class,
|
||||
host
|
||||
.getBoundingBox()
|
||||
.inflate(ModConfig.SERVER.dialogueRadius.get())
|
||||
.inflate(SettingsAccessor.getDialogueRadius())
|
||||
);
|
||||
|
||||
// Get captor entity for comparison
|
||||
@@ -258,7 +258,7 @@ public class DamselAIController {
|
||||
}
|
||||
|
||||
// Reset cooldown
|
||||
int baseCooldown = ModConfig.SERVER.dialogueCooldown.get();
|
||||
int baseCooldown = SettingsAccessor.getDialogueCooldown();
|
||||
if (foundTarget) {
|
||||
// Full cooldown if we talked
|
||||
this.callForHelpCooldown =
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.tiedup.remake.entities.damsel.components;
|
||||
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.dialogue.EntityDialogueManager;
|
||||
import com.tiedup.remake.dialogue.EntityDialogueManager.DialogueCategory;
|
||||
import java.util.HashMap;
|
||||
@@ -101,7 +101,7 @@ public class DamselDialogueHandler {
|
||||
|
||||
if (
|
||||
lastUsed != null &&
|
||||
(currentTick - lastUsed) < ModConfig.SERVER.dialogueCooldown.get()
|
||||
(currentTick - lastUsed) < SettingsAccessor.getDialogueCooldown()
|
||||
) {
|
||||
return false; // Still on cooldown
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.tiedup.remake.entities.damsel.components;
|
||||
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.entities.AbstractTiedUpNpc;
|
||||
import com.tiedup.remake.state.ICaptor;
|
||||
@@ -137,7 +137,7 @@ public class NpcCaptivityManager {
|
||||
if (!entity.level().isClientSide()) {
|
||||
host.talkToPlayersInRadius(
|
||||
com.tiedup.remake.dialogue.EntityDialogueManager.DialogueCategory.DAMSEL_FREED,
|
||||
ModConfig.SERVER.dialogueRadius.get()
|
||||
SettingsAccessor.getDialogueRadius()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.tiedup.remake.entities.damsel.components;
|
||||
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.entities.AbstractTiedUpNpc;
|
||||
import com.tiedup.remake.items.base.ILockable;
|
||||
@@ -206,7 +206,7 @@ public class NpcEquipmentManager {
|
||||
if (!wasAlreadyTied && !entity.level().isClientSide()) {
|
||||
host.talkToPlayersInRadius(
|
||||
com.tiedup.remake.dialogue.EntityDialogueManager.DialogueCategory.DAMSEL_CAPTURED,
|
||||
ModConfig.SERVER.dialogueRadius.get()
|
||||
SettingsAccessor.getDialogueRadius()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.tiedup.remake.entities.kidnapper.components;
|
||||
|
||||
import com.tiedup.remake.cells.CellDataV2;
|
||||
import com.tiedup.remake.core.ModConfig;
|
||||
import com.tiedup.remake.core.SettingsAccessor;
|
||||
import com.tiedup.remake.core.TiedUpMod;
|
||||
import com.tiedup.remake.dialogue.EntityDialogueManager;
|
||||
import com.tiedup.remake.entities.EntityKidnapper;
|
||||
@@ -628,7 +628,7 @@ public class KidnapperCaptiveManager {
|
||||
|
||||
// Apply blindfold if enabled in config
|
||||
if (
|
||||
com.tiedup.remake.core.ModConfig.SERVER.abandonKeepsBlindfold.get()
|
||||
SettingsAccessor.isAbandonKeepsBlindfold()
|
||||
) {
|
||||
net.minecraft.world.item.ItemStack blindfold = getBlindfoldItem();
|
||||
if (
|
||||
@@ -652,7 +652,7 @@ public class KidnapperCaptiveManager {
|
||||
|
||||
// Remove restraints if NOT configured to keep them
|
||||
boolean keepBinds =
|
||||
com.tiedup.remake.core.ModConfig.SERVER.abandonKeepsBinds.get();
|
||||
SettingsAccessor.isAbandonKeepsBinds();
|
||||
if (!keepBinds) {
|
||||
// Full release including binds
|
||||
this.currentCaptive.untie(true);
|
||||
|
||||
Reference in New Issue
Block a user