Config getters and setters
Changes to be committed modified: src/main/java/org/dimdev/dimdoors/ModConfig.java
This commit is contained in:
parent
c2097b5c62
commit
018cced6b6
1 changed files with 123 additions and 0 deletions
|
@ -4,6 +4,7 @@ import java.util.LinkedHashSet;
|
|||
import java.util.Set;
|
||||
|
||||
public final class ModConfig {
|
||||
public static ModConfig INSTANCE;
|
||||
public static final General GENERAL = new General();
|
||||
public static final Pockets POCKETS = new Pockets();
|
||||
public static final World WORLD = new World();
|
||||
|
@ -12,6 +13,52 @@ public final class ModConfig {
|
|||
public static final Limbo LIMBO = new Limbo();
|
||||
public static final Graphics GRAPHICS = new Graphics();
|
||||
|
||||
private final General generalConfig;
|
||||
private final Pockets pocketsConfig;
|
||||
private final World worldConfig;
|
||||
private final Dungeons dungeonsConfig;
|
||||
private final Monoliths monolithsConfig;
|
||||
private final Limbo limboConfig;
|
||||
private final Graphics graphicsConfig;
|
||||
|
||||
protected ModConfig(General generalConfig, Pockets pocketsConfig, World worldConfig, Dungeons dungeonsConfig, Monoliths monolithsConfig, Limbo limboConfig, Graphics graphicsConfig) {
|
||||
this.generalConfig = generalConfig;
|
||||
this.pocketsConfig = pocketsConfig;
|
||||
this.worldConfig = worldConfig;
|
||||
this.dungeonsConfig = dungeonsConfig;
|
||||
this.monolithsConfig = monolithsConfig;
|
||||
this.limboConfig = limboConfig;
|
||||
this.graphicsConfig = graphicsConfig;
|
||||
}
|
||||
|
||||
public General getGeneralConfig() {
|
||||
return this.generalConfig;
|
||||
}
|
||||
|
||||
public Pockets getPocketsConfig() {
|
||||
return this.pocketsConfig;
|
||||
}
|
||||
|
||||
public World getWorldConfig() {
|
||||
return this.worldConfig;
|
||||
}
|
||||
|
||||
public Dungeons getDungeonsConfig() {
|
||||
return this.dungeonsConfig;
|
||||
}
|
||||
|
||||
public Monoliths getMonolithsConfig() {
|
||||
return this.monolithsConfig;
|
||||
}
|
||||
|
||||
public Limbo getLimboConfig() {
|
||||
return this.limboConfig;
|
||||
}
|
||||
|
||||
public Graphics getGraphicsConfig() {
|
||||
return this.graphicsConfig;
|
||||
}
|
||||
|
||||
public static class General {
|
||||
public boolean closeDoorBehind = false;
|
||||
public double teleportOffset = 0.5;
|
||||
|
@ -22,6 +69,20 @@ public final class ModConfig {
|
|||
public boolean useEnderPearlsInCrafting = false;
|
||||
public double endermanSpawnChance = 0.001;
|
||||
public double endermanAggressiveChance = 0.5;
|
||||
|
||||
public static General create(boolean closeDoorBehind, double teleportOffset, boolean riftBoundingBoxInCreative, double riftCloseSpeed, double riftGrowthSpeed, int depthSpreadFactor, boolean useEnderPearlsInCrafting, double endermanSpawnChance, double endermanAggressiveChance) {
|
||||
General general = new General();
|
||||
general.closeDoorBehind = closeDoorBehind;
|
||||
general.teleportOffset = teleportOffset;
|
||||
general.riftBoundingBoxInCreative = riftBoundingBoxInCreative;
|
||||
general.riftCloseSpeed = riftCloseSpeed;
|
||||
general.riftGrowthSpeed = riftGrowthSpeed;
|
||||
general.depthSpreadFactor = depthSpreadFactor;
|
||||
general.useEnderPearlsInCrafting = useEnderPearlsInCrafting;
|
||||
general.endermanSpawnChance = endermanSpawnChance;
|
||||
general.endermanAggressiveChance = endermanAggressiveChance;
|
||||
return general;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Pockets {
|
||||
|
@ -31,6 +92,17 @@ public final class ModConfig {
|
|||
public int publicPocketSize = 1;
|
||||
public boolean loadAllSchematics = false;
|
||||
public int cachedSchematics = 10;
|
||||
|
||||
public static Pockets create(int pocketGridSize, int maxPocketSize, int privatePocketSize, int publicPocketSize, boolean loadAllSchematics, int cachedSchematics) {
|
||||
Pockets pockets = new Pockets();
|
||||
pockets.pocketGridSize = pocketGridSize;
|
||||
pockets.maxPocketSize = maxPocketSize;
|
||||
pockets.privatePocketSize = privatePocketSize;
|
||||
pockets.publicPocketSize = publicPocketSize;
|
||||
pockets.loadAllSchematics = loadAllSchematics;
|
||||
pockets.cachedSchematics = cachedSchematics;
|
||||
return pockets;
|
||||
}
|
||||
}
|
||||
|
||||
public static class World {
|
||||
|
@ -38,21 +110,51 @@ public final class ModConfig {
|
|||
public int gatewayGenChance = 80;
|
||||
public Set<Integer> clusterDimBlacklist = new LinkedHashSet<>();
|
||||
public Set<Integer> gatewayDimBlacklist = new LinkedHashSet<>();
|
||||
|
||||
public static World create(double clusterGenChance, int gatewayGenChance, Set<Integer> clusterDimBlacklist, Set<Integer> gatewayDimBlacklist) {
|
||||
World world = new World();
|
||||
world.clusterGenChance = clusterGenChance;
|
||||
world.gatewayGenChance = gatewayGenChance;
|
||||
world.clusterDimBlacklist = clusterDimBlacklist;
|
||||
world.gatewayDimBlacklist = gatewayDimBlacklist;
|
||||
return world;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Dungeons {
|
||||
public int maxDungeonDepth = 50;
|
||||
|
||||
public static Dungeons create(int maxDungeonDepth) {
|
||||
Dungeons dungeons = new Dungeons();
|
||||
dungeons.maxDungeonDepth = maxDungeonDepth;
|
||||
return dungeons;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Monoliths {
|
||||
public boolean dangerousLimboMonoliths = false;
|
||||
public boolean monolithTeleportation = true;
|
||||
|
||||
public static Monoliths create(boolean dangerousLimboMonoliths, boolean monolithTeleportation) {
|
||||
Monoliths monoliths = new Monoliths();
|
||||
monoliths.dangerousLimboMonoliths = dangerousLimboMonoliths;
|
||||
monoliths.monolithTeleportation = monolithTeleportation;
|
||||
return monoliths;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Limbo {
|
||||
public boolean universalLimbo = false;
|
||||
public boolean hardcoreLimbo = false;
|
||||
public double decaySpreadChance = 0.5;
|
||||
|
||||
public static Limbo create(boolean universalLimbo, boolean hardcoreLimbo, double decaySpreadChance) {
|
||||
Limbo limbo = new Limbo();
|
||||
limbo.universalLimbo = universalLimbo;
|
||||
limbo.hardcoreLimbo = hardcoreLimbo;
|
||||
limbo.decaySpreadChance = decaySpreadChance;
|
||||
return limbo;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Graphics {
|
||||
|
@ -60,5 +162,26 @@ public final class ModConfig {
|
|||
public int highlightRiftCoreFor = 15000;
|
||||
public double riftSize = 1;
|
||||
public double riftJitter = 1;
|
||||
|
||||
public static Graphics create(boolean showRiftCore, int highlightRiftCoreFor, double riftSize, double riftJitter) {
|
||||
Graphics graphics = new Graphics();
|
||||
graphics.showRiftCore = showRiftCore;
|
||||
graphics.highlightRiftCoreFor = highlightRiftCoreFor;
|
||||
graphics.riftSize = riftSize;
|
||||
graphics.riftJitter = riftJitter;
|
||||
return graphics;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
INSTANCE = new ModConfig(
|
||||
new General(),
|
||||
new Pockets(),
|
||||
new World(),
|
||||
new Dungeons(),
|
||||
new Monoliths(),
|
||||
new Limbo(),
|
||||
new Graphics()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue