Skip to content

Commit

Permalink
Add ability to specify if a world should mirror gamerules from the ov…
Browse files Browse the repository at this point in the history
…erworld. This is how a vanilla custom dimension behaves. (#42)
  • Loading branch information
kyrptonaught authored Dec 13, 2023
1 parent dbab6af commit 0f61f4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/xyz/nucleoid/fantasy/RuntimeWorldConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public final class RuntimeWorldConfig {
private long timeOfDay = 6000;
private Difficulty difficulty = Difficulty.NORMAL;
private final GameRuleStore gameRules = new GameRuleStore();
private boolean mirrorOverworldGameRules = false;
private RuntimeWorld.Constructor worldConstructor = RuntimeWorld::new;

private int sunnyTime = Integer.MAX_VALUE;
Expand Down Expand Up @@ -97,6 +98,11 @@ public RuntimeWorldConfig setGameRule(GameRules.Key<GameRules.IntRule> key, int
return this;
}

public RuntimeWorldConfig setMirrorOverworldGameRules(boolean mirror) {
this.mirrorOverworldGameRules = mirror;
return this;
}

public RuntimeWorldConfig setSunny(int sunnyTime) {
this.sunnyTime = sunnyTime;
this.raining = false;
Expand Down Expand Up @@ -178,6 +184,10 @@ public GameRuleStore getGameRules() {
return this.gameRules;
}

public boolean shouldMirrorOverworldGameRules(){
return this.mirrorOverworldGameRules;
}

public int getSunnyTime() {
return this.sunnyTime;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public RuntimeWorldProperties(SaveProperties saveProperties, RuntimeWorldConfig

@Override
public GameRules getGameRules() {
if (this.config.shouldMirrorOverworldGameRules())
return super.getGameRules();
return this.rules;
}

Expand Down

0 comments on commit 0f61f4d

Please sign in to comment.