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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user