Config getters and setters

Changes to be committed
	modified:   src/main/java/org/dimdev/dimdoors/ModConfig.java
This commit is contained in:
SD 2020-09-25 22:19:44 +05:30
parent c2097b5c62
commit 018cced6b6
No known key found for this signature in database
GPG key ID: E36B57EE08544BC5

View file

@ -4,6 +4,7 @@ import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
public final class ModConfig { public final class ModConfig {
public static ModConfig INSTANCE;
public static final General GENERAL = new General(); public static final General GENERAL = new General();
public static final Pockets POCKETS = new Pockets(); public static final Pockets POCKETS = new Pockets();
public static final World WORLD = new World(); 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 Limbo LIMBO = new Limbo();
public static final Graphics GRAPHICS = new Graphics(); 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 static class General {
public boolean closeDoorBehind = false; public boolean closeDoorBehind = false;
public double teleportOffset = 0.5; public double teleportOffset = 0.5;
@ -22,6 +69,20 @@ public final class ModConfig {
public boolean useEnderPearlsInCrafting = false; public boolean useEnderPearlsInCrafting = false;
public double endermanSpawnChance = 0.001; public double endermanSpawnChance = 0.001;
public double endermanAggressiveChance = 0.5; 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 { public static class Pockets {
@ -31,6 +92,17 @@ public final class ModConfig {
public int publicPocketSize = 1; public int publicPocketSize = 1;
public boolean loadAllSchematics = false; public boolean loadAllSchematics = false;
public int cachedSchematics = 10; 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 { public static class World {
@ -38,21 +110,51 @@ public final class ModConfig {
public int gatewayGenChance = 80; public int gatewayGenChance = 80;
public Set<Integer> clusterDimBlacklist = new LinkedHashSet<>(); public Set<Integer> clusterDimBlacklist = new LinkedHashSet<>();
public Set<Integer> gatewayDimBlacklist = 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 static class Dungeons {
public int maxDungeonDepth = 50; public int maxDungeonDepth = 50;
public static Dungeons create(int maxDungeonDepth) {
Dungeons dungeons = new Dungeons();
dungeons.maxDungeonDepth = maxDungeonDepth;
return dungeons;
}
} }
public static class Monoliths { public static class Monoliths {
public boolean dangerousLimboMonoliths = false; public boolean dangerousLimboMonoliths = false;
public boolean monolithTeleportation = true; 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 static class Limbo {
public boolean universalLimbo = false; public boolean universalLimbo = false;
public boolean hardcoreLimbo = false; public boolean hardcoreLimbo = false;
public double decaySpreadChance = 0.5; 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 { public static class Graphics {
@ -60,5 +162,26 @@ public final class ModConfig {
public int highlightRiftCoreFor = 15000; public int highlightRiftCoreFor = 15000;
public double riftSize = 1; public double riftSize = 1;
public double riftJitter = 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()
);
} }
} }