WIP: add RepairTier, RecipeIngredient, and config skeleton
This commit is contained in:
115
src/main/java/xyz/quickbasic/tieredrepairkits/TRKConfig.java
Normal file
115
src/main/java/xyz/quickbasic/tieredrepairkits/TRKConfig.java
Normal file
@@ -0,0 +1,115 @@
|
||||
package xyz.quickbasic.tieredrepairkits;
|
||||
|
||||
import com.hypixel.hytale.codec.KeyedCodec;
|
||||
import com.hypixel.hytale.codec.builder.BuilderCodec;
|
||||
import xyz.quickbasic.tieredrepairkits.config.RepairTier;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
// Main config class for TieredRepairKits
|
||||
public class TRKConfig {
|
||||
|
||||
public static final BuilderCodec<TRKConfig> CODEC = BuilderCodec.builder(TRKConfig.class, TRKConfig::new)
|
||||
|
||||
.append(new KeyedCodec<RepairTier>("TierCopper", RepairTier.CODEC),
|
||||
(cfg, val) -> cfg.tierCopper = val,
|
||||
cfg -> cfg.tierCopper).add()
|
||||
|
||||
.append(new KeyedCodec<RepairTier>("TierIron", RepairTier.CODEC),
|
||||
(cfg, val) -> cfg.tierIron = val,
|
||||
cfg -> cfg.tierIron).add()
|
||||
|
||||
.append(new KeyedCodec<RepairTier>("TierSilver", RepairTier.CODEC),
|
||||
(cfg, val) -> cfg.tierSilver = val,
|
||||
cfg -> cfg.tierSilver).add()
|
||||
|
||||
.append(new KeyedCodec<RepairTier>("TierGold", RepairTier.CODEC),
|
||||
(cfg, val) -> cfg.tierGold = val,
|
||||
cfg -> cfg.tierGold).add()
|
||||
|
||||
.append(new KeyedCodec<RepairTier>("TierThorium", RepairTier.CODEC),
|
||||
(cfg, val) -> cfg.tierThorium = val,
|
||||
cfg -> cfg.tierThorium).add()
|
||||
|
||||
.append(new KeyedCodec<RepairTier>("TierCobalt", RepairTier.CODEC),
|
||||
(cfg, val) -> cfg.tierCobalt = val,
|
||||
cfg -> cfg.tierCobalt).add()
|
||||
|
||||
.append(new KeyedCodec<RepairTier>("TierAdamantite", RepairTier.CODEC),
|
||||
(cfg, val) -> cfg.tierAdamantite = val,
|
||||
cfg -> cfg.tierAdamantite).add()
|
||||
|
||||
.append(new KeyedCodec<RepairTier>("TierMithril", RepairTier.CODEC),
|
||||
(cfg, val) -> cfg.tierMithril = val,
|
||||
cfg -> cfg.tierMithril).add()
|
||||
|
||||
.append(new KeyedCodec<RepairTier>("TierOnyxium", RepairTier.CODEC),
|
||||
(cfg, val) -> cfg.tierOnyxium = val,
|
||||
cfg -> cfg.tierOnyxium).add()
|
||||
|
||||
.append(new KeyedCodec<RepairTier>("TierPrisma", RepairTier.CODEC),
|
||||
(cfg, val) -> cfg.tierPrisma = val,
|
||||
cfg -> cfg.tierPrisma).add()
|
||||
|
||||
.build();
|
||||
|
||||
// --- Tier fields ---
|
||||
private RepairTier tierCopper = new RepairTier();
|
||||
private RepairTier tierIron = new RepairTier();
|
||||
private RepairTier tierSilver = new RepairTier();
|
||||
private RepairTier tierGold = new RepairTier();
|
||||
private RepairTier tierThorium = new RepairTier();
|
||||
private RepairTier tierCobalt = new RepairTier();
|
||||
private RepairTier tierAdamantite = new RepairTier();
|
||||
private RepairTier tierMithril = new RepairTier();
|
||||
private RepairTier tierOnyxium = new RepairTier();
|
||||
private RepairTier tierPrisma = new RepairTier();
|
||||
|
||||
// Cached map for runtime convenience
|
||||
private Map<String, RepairTier> cachedMap;
|
||||
|
||||
public TRKConfig() {}
|
||||
|
||||
// Returns a map of tier names -> RepairTier
|
||||
public Map<String, RepairTier> getTiers() {
|
||||
if (cachedMap == null) {
|
||||
cachedMap = new LinkedHashMap<>();
|
||||
cachedMap.put("TierCopper", tierCopper);
|
||||
cachedMap.put("TierIron", tierIron);
|
||||
cachedMap.put("TierSilver", tierSilver);
|
||||
cachedMap.put("TierGold", tierGold);
|
||||
cachedMap.put("TierThorium", tierThorium);
|
||||
cachedMap.put("TierCobalt", tierCobalt);
|
||||
cachedMap.put("TierAdamantite", tierAdamantite);
|
||||
cachedMap.put("TierMithril", tierMithril);
|
||||
cachedMap.put("TierOnyxium", tierOnyxium);
|
||||
cachedMap.put("TierPrisma", tierPrisma);
|
||||
}
|
||||
return cachedMap;
|
||||
}
|
||||
|
||||
// Individual tier getters
|
||||
public RepairTier getTierCopper() { return tierCopper; }
|
||||
public RepairTier getTierIron() { return tierIron; }
|
||||
public RepairTier getTierSilver() { return tierSilver; }
|
||||
public RepairTier getTierGold() { return tierGold; }
|
||||
public RepairTier getTierThorium() { return tierThorium; }
|
||||
public RepairTier getTierCobalt() { return tierCobalt; }
|
||||
public RepairTier getTierAdamantite() { return tierAdamantite; }
|
||||
public RepairTier getTierMithril() { return tierMithril; }
|
||||
public RepairTier getTierOnyxium() { return tierOnyxium; }
|
||||
public RepairTier getTierPrisma() { return tierPrisma; }
|
||||
|
||||
// Individual tier setters (optional, also clears cached map)
|
||||
public void setTierCopper(RepairTier tier) { this.tierCopper = tier; cachedMap = null; }
|
||||
public void setTierIron(RepairTier tier) { this.tierIron = tier; cachedMap = null; }
|
||||
public void setTierSilver(RepairTier tier) { this.tierSilver = tier; cachedMap = null; }
|
||||
public void setTierGold(RepairTier tier) { this.tierGold = tier; cachedMap = null; }
|
||||
public void setTierThorium(RepairTier tier) { this.tierThorium = tier; cachedMap = null; }
|
||||
public void setTierCobalt(RepairTier tier) { this.tierCobalt = tier; cachedMap = null; }
|
||||
public void setTierAdamantite(RepairTier tier) { this.tierAdamantite = tier; cachedMap = null; }
|
||||
public void setTierMithril(RepairTier tier) { this.tierMithril = tier; cachedMap = null; }
|
||||
public void setTierOnyxium(RepairTier tier) { this.tierOnyxium = tier; cachedMap = null; }
|
||||
public void setTierPrisma(RepairTier tier) { this.tierPrisma = tier; cachedMap = null; }
|
||||
}
|
||||
Reference in New Issue
Block a user