Skip to content

Commit

Permalink
Implement Noisium
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed May 12, 2024
1 parent 41339e6 commit 37aab0d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
21 changes: 18 additions & 3 deletions patches/server/0003-Add-basic-configuration-parts.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Add basic configuration parts


diff --git a/src/main/java/org/plazmamc/thunderbolt/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/thunderbolt/configurations/GlobalConfiguration.java
index fbac06d6c70fd6250f16a6bdbea21873ff5e1d2a..0b16bbf87a6c5e658e8182e423800acd16dfc7ca 100644
index fbac06d6c70fd6250f16a6bdbea21873ff5e1d2a..1b1d08f00716551a26a5cee1133d2ce77fc8d1b7 100644
--- a/src/main/java/org/plazmamc/thunderbolt/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/thunderbolt/configurations/GlobalConfiguration.java
@@ -25,4 +25,20 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -25,4 +25,22 @@ public class GlobalConfiguration extends ConfigurationPart {
@Setting(Configuration.VERSION_FIELD)
int version = VERSION;

Expand All @@ -18,7 +18,9 @@ index fbac06d6c70fd6250f16a6bdbea21873ff5e1d2a..0b16bbf87a6c5e658e8182e423800acd
+
+ @PostProcess
+ public void post() {
+ if (ThunderboltConfigurations.GLOBAL_LOADED) {
+ boolean changed = ThunderboltConfigurations.GLOBAL_LOADED;
+
+ if (changed) {
+ ThunderboltConfigurations.LOGGER.warn("Configuration settings that require a restart have been changed."
+ + "The settings will take effect at the next restart.");
+ return;
Expand All @@ -29,3 +31,16 @@ index fbac06d6c70fd6250f16a6bdbea21873ff5e1d2a..0b16bbf87a6c5e658e8182e423800acd
+ }
+
}
diff --git a/src/main/java/org/plazmamc/thunderbolt/configurations/ThunderboltConfigurations.java b/src/main/java/org/plazmamc/thunderbolt/configurations/ThunderboltConfigurations.java
index 2b6653148b6a3586373efffa7a74caf2dd5e560c..219a2ec97a69abdcf7f018c053b1d014ee4b42e2 100644
--- a/src/main/java/org/plazmamc/thunderbolt/configurations/ThunderboltConfigurations.java
+++ b/src/main/java/org/plazmamc/thunderbolt/configurations/ThunderboltConfigurations.java
@@ -160,7 +160,7 @@ public class ThunderboltConfigurations extends Configurations<GlobalConfiguratio

@Override
protected WorldConfigurations getWorldConfiguration(ServerLevel level) {
- throw new UnsupportedOperationException("TODO");
+ return level.thunderboltConfig();
}

@Override
11 changes: 8 additions & 3 deletions patches/server/0004-Implement-Noisium.patch
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,23 @@ index afdbc74a3012fa717f59ecef613567338d285b7b..23fb7d811772804c7256981bbaca4ad7

return null;
diff --git a/src/main/java/org/plazmamc/thunderbolt/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/thunderbolt/configurations/GlobalConfiguration.java
index 0b16bbf87a6c5e658e8182e423800acd16dfc7ca..f1cc8de931ff068a387a91d1ae8e2e6cf91036ff 100644
index 1b1d08f00716551a26a5cee1133d2ce77fc8d1b7..ced99d9c788d0a9b9db60e58a9ef4ad910aa1d3a 100644
--- a/src/main/java/org/plazmamc/thunderbolt/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/thunderbolt/configurations/GlobalConfiguration.java
@@ -28,6 +28,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -28,10 +28,12 @@ public class GlobalConfiguration extends ConfigurationPart {
public NeedsReload needsReload;
public class NeedsReload extends ConfigurationPart {

+ boolean enableNoisium = optimize();

@PostProcess
public void post() {
@@ -37,6 +38,7 @@ public class GlobalConfiguration extends ConfigurationPart {
boolean changed = ThunderboltConfigurations.GLOBAL_LOADED;
+ changed &= this.enableNoisium != net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator.NOISIUM;

if (changed) {
ThunderboltConfigurations.LOGGER.warn("Configuration settings that require a restart have been changed."
@@ -39,6 +41,7 @@ public class GlobalConfiguration extends ConfigurationPart {
return;
}

Expand Down

0 comments on commit 37aab0d

Please sign in to comment.