mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 08:57:35 +01:00
Update configurable feature seed patch
This commit is contained in:
parent
b26d590d0c
commit
e1c2939c11
@ -743,10 +743,10 @@ index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6c19825de43b82ba3fe6e44123e7d24748698614
|
||||
index 0000000000000000000000000000000000000000..aa52663a65381f175411a37f9b0731de5ed772aa
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -0,0 +1,325 @@
|
||||
@@ -0,0 +1,323 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import com.google.common.collect.Table;
|
||||
@ -815,32 +815,30 @@ index 0000000000000000000000000000000000000000..6c19825de43b82ba3fe6e44123e7d247
|
||||
+
|
||||
+ private static final String GLOBAL_HEADER = """
|
||||
+ This is the global configuration file for Paper.
|
||||
+ As you can see, there's tons to configure. Some options may impact gameplay, so use
|
||||
+ As you can see, there's a lot to configure. Some options may impact gameplay, so use
|
||||
+ with caution, and make sure you know what each option does before configuring.
|
||||
+
|
||||
+ If you need help with the configuration or have any questions related to Paper,
|
||||
+ join us in our Discord or IRC channel.
|
||||
+ join us in our Discord or check the docs page.
|
||||
+
|
||||
+ The world configuration options have been moved to their own files.
|
||||
+
|
||||
+ Discord: https://discord.gg/papermc
|
||||
+ IRC: #paper @ irc.esper.net ( https://webchat.esper.net/?channels=paper )
|
||||
+ Website: https://papermc.io/
|
||||
+ Docs: https://docs.papermc.io/""";
|
||||
+
|
||||
+ private static final String WORLD_DEFAULTS_HEADER = """
|
||||
+ This is the world defaults configuration file for Paper.
|
||||
+ As you can see, there's tons to configure. Some options may impact gameplay, so use
|
||||
+ As you can see, there's a lot to configure. Some options may impact gameplay, so use
|
||||
+ with caution, and make sure you know what each option does before configuring.
|
||||
+
|
||||
+ If you need help with the configuration or have any questions related to Paper,
|
||||
+ join us in our Discord or IRC channel.
|
||||
+ join us in our Discord or check the docs page.
|
||||
+
|
||||
+ Configuration options here apply to all worlds, unless you specify overrides inside
|
||||
+ the world-specific config file inside each world folder.
|
||||
+
|
||||
+ Discord: https://discord.gg/papermc
|
||||
+ IRC: #paper @ irc.esper.net ( https://webchat.esper.net/?channels=paper )
|
||||
+ Website: https://papermc.io/
|
||||
+ Docs: https://docs.papermc.io/""";
|
||||
+
|
||||
@ -1074,15 +1072,16 @@ index 0000000000000000000000000000000000000000..6c19825de43b82ba3fe6e44123e7d247
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..87ebdc61a3802ea33d3c77904122d5005fac77c2
|
||||
index 0000000000000000000000000000000000000000..163f02b4bf34da712b30166e80d859a96bf8d911
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -0,0 +1,447 @@
|
||||
@@ -0,0 +1,470 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray;
|
||||
+import com.google.common.collect.HashBasedTable;
|
||||
+import com.google.common.collect.Table;
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import io.papermc.paper.configuration.constraint.Constraint;
|
||||
+import io.papermc.paper.configuration.constraint.Constraints;
|
||||
+import io.papermc.paper.configuration.legacy.MaxEntityCollisionsInitializer;
|
||||
@ -1110,6 +1109,7 @@ index 0000000000000000000000000000000000000000..87ebdc61a3802ea33d3c77904122d500
|
||||
+import net.minecraft.world.item.Items;
|
||||
+import net.minecraft.world.level.NaturalSpawner;
|
||||
+import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
+import org.slf4j.Logger;
|
||||
+import org.spigotmc.SpigotWorldConfig;
|
||||
+import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
+import org.spongepowered.configurate.objectmapping.meta.Required;
|
||||
@ -1123,6 +1123,7 @@ index 0000000000000000000000000000000000000000..87ebdc61a3802ea33d3c77904122d500
|
||||
+
|
||||
+@SuppressWarnings({"FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"})
|
||||
+public class WorldConfiguration extends ConfigurationPart {
|
||||
+ private static final Logger LOGGER = LogUtils.getLogger();
|
||||
+ static final int CURRENT_VERSION = 28;
|
||||
+
|
||||
+ private transient final SpigotWorldConfig spigotConfig;
|
||||
@ -1500,10 +1501,30 @@ index 0000000000000000000000000000000000000000..87ebdc61a3802ea33d3c77904122d500
|
||||
+
|
||||
+ public FeatureSeeds featureSeeds;
|
||||
+
|
||||
+ public class FeatureSeeds extends ConfigurationPart {
|
||||
+ public class FeatureSeeds extends ConfigurationPart.Post {
|
||||
+ public boolean generateRandomSeedsForAll = false;
|
||||
+ public Reference2LongMap<Holder<ConfiguredFeature<?, ?>>> features = new Reference2LongOpenHashMap<>();
|
||||
+ // TODO post processing to generate random seeds if generateRandomSeedsForAll == true
|
||||
+
|
||||
+ @Override
|
||||
+ public void postProcess() {
|
||||
+ features.defaultReturnValue(-1);
|
||||
+ if (generateRandomSeedsForAll) {
|
||||
+ final java.util.Random random = new java.security.SecureRandom();
|
||||
+ boolean added[] = {false};
|
||||
+ net.minecraft.server.MinecraftServer.getServer().registryAccess().registry(Registry.CONFIGURED_FEATURE_REGISTRY).get().holders().forEach(holder -> {
|
||||
+ if (features.containsKey(holder)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final long seed = random.nextLong();
|
||||
+ features.put(holder, seed);
|
||||
+ added[0] = true;
|
||||
+ });
|
||||
+ if (added[0]) {
|
||||
+ LOGGER.info("Generated random feature seeds.");
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public Misc misc;
|
||||
|
@ -297,7 +297,7 @@ index 0000000000000000000000000000000000000000..e75134a6aa92c86aa86430c7603e1112
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
index 6c19825de43b82ba3fe6e44123e7d24748698614..f06f130b2fa703e105f9d49bc755e8374d023f2e 100644
|
||||
index aa52663a65381f175411a37f9b0731de5ed772aa..d9f5c4154516d136c0e3488be07c8df84cb3ea35 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -1,5 +1,6 @@
|
||||
@ -307,7 +307,7 @@ index 6c19825de43b82ba3fe6e44123e7d24748698614..f06f130b2fa703e105f9d49bc755e837
|
||||
import com.google.common.collect.Table;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
@@ -283,6 +284,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -281,6 +282,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
|
||||
private static final Map<String, Command> COMMANDS = new HashMap<>();
|
||||
static {
|
||||
|
@ -690,7 +690,7 @@ index 0000000000000000000000000000000000000000..5a19e30a9b7e65a70f68a429b8ca741f
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
index f06f130b2fa703e105f9d49bc755e8374d023f2e..ef407d6a961c327631656cfd4cc610a22a9e53ac 100644
|
||||
index d9f5c4154516d136c0e3488be07c8df84cb3ea35..e279559cd8929642d80eea89b9a89d7ebe982586 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -1,5 +1,6 @@
|
||||
@ -700,7 +700,7 @@ index f06f130b2fa703e105f9d49bc755e8374d023f2e..ef407d6a961c327631656cfd4cc610a2
|
||||
import com.destroystokyo.paper.PaperCommand;
|
||||
import com.google.common.collect.Table;
|
||||
import com.mojang.logging.LogUtils;
|
||||
@@ -283,6 +284,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -281,6 +282,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
}
|
||||
|
||||
private static final Map<String, Command> COMMANDS = new HashMap<>();
|
||||
@ -708,7 +708,7 @@ index f06f130b2fa703e105f9d49bc755e8374d023f2e..ef407d6a961c327631656cfd4cc610a2
|
||||
static {
|
||||
COMMANDS.put("paper", new PaperCommand("paper"));
|
||||
}
|
||||
@@ -291,6 +293,11 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -289,6 +291,11 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
COMMANDS.forEach((s, command) -> {
|
||||
server.server.getCommandMap().register(s, "Paper", command);
|
||||
});
|
||||
|
@ -1017,7 +1017,7 @@ index 0000000000000000000000000000000000000000..80a2dfb266ae1221680a7b24fee2f7e2
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
index ef407d6a961c327631656cfd4cc610a22a9e53ac..0f185ff1af93d40519e8f093b1e63b530656d616 100644
|
||||
index e279559cd8929642d80eea89b9a89d7ebe982586..7a2d1cf4343f8bb4c0682b0ab9bb87957d8b3284 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -2,6 +2,7 @@ package io.papermc.paper.configuration;
|
||||
@ -1028,7 +1028,7 @@ index ef407d6a961c327631656cfd4cc610a22a9e53ac..0f185ff1af93d40519e8f093b1e63b53
|
||||
import com.google.common.collect.Table;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
@@ -171,6 +172,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -169,6 +170,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
.register(DoubleOrDefault.SERIALIZER)
|
||||
.register(BooleanOrDefault.SERIALIZER)
|
||||
.register(Duration.SERIALIZER)
|
||||
|
@ -110,7 +110,7 @@ index 0000000000000000000000000000000000000000..874f0c2a071994c2145848886caa385e
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
index 0f185ff1af93d40519e8f093b1e63b530656d616..1ba72bf064dda8c0e9b8ff4e51a713951e4db46c 100644
|
||||
index 7a2d1cf4343f8bb4c0682b0ab9bb87957d8b3284..e8c8b9ff56f64fa63387d21c5fcab69915ff9770 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -1,5 +1,6 @@
|
||||
@ -120,7 +120,7 @@ index 0f185ff1af93d40519e8f093b1e63b530656d616..1ba72bf064dda8c0e9b8ff4e51a71395
|
||||
import com.destroystokyo.paper.Metrics;
|
||||
import com.destroystokyo.paper.PaperCommand;
|
||||
import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray;
|
||||
@@ -289,6 +290,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -287,6 +288,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
private static boolean metricsStarted = false;
|
||||
static {
|
||||
COMMANDS.put("paper", new PaperCommand("paper"));
|
||||
|
@ -19,27 +19,17 @@ index 46297ac0a19fd2398ab777a381eff4d0a256161e..78280fb3bcd8d792a58ece6d735e0824
|
||||
}
|
||||
final Object val = config.get(key);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
index a4e2ee3efde40c902555f982ffa546c24bc31377..ec7343c7acb438781026b25390528889209fe97a 100644
|
||||
index a4e2ee3efde40c902555f982ffa546c24bc31377..ef53c68c1996e99bc6b6048d5b1bc290cf218158 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -530,7 +530,7 @@ public abstract class ChunkGenerator {
|
||||
int j = list.size();
|
||||
|
||||
try {
|
||||
- Registry<PlacedFeature> iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY);
|
||||
+ Registry<PlacedFeature> iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); // Paper - diff on change
|
||||
int k = Math.max(GenerationStep.Decoration.values().length, j);
|
||||
|
||||
for (int l = 0; l < k; ++l) {
|
||||
@@ -603,7 +603,15 @@ public abstract class ChunkGenerator {
|
||||
@@ -603,7 +603,14 @@ public abstract class ChunkGenerator {
|
||||
return (String) optional.orElseGet(placedfeature::toString);
|
||||
};
|
||||
|
||||
- seededrandom.setFeatureSeed(i, l1, l);
|
||||
+ // Paper start - change populationSeed used in random
|
||||
+ long featurePopulationSeed = i;
|
||||
+ final net.minecraft.resources.ResourceLocation location = iregistry1.getKey(placedfeature);
|
||||
+ final long configFeatureSeed = generatoraccessseed.getMinecraftWorld().paperConfig().featureSeeds.features.getLong(location); // TODO this wont work
|
||||
+ final long configFeatureSeed = generatoraccessseed.getMinecraftWorld().paperConfig().featureSeeds.features.getLong(placedfeature.feature());
|
||||
+ if (configFeatureSeed != -1) {
|
||||
+ featurePopulationSeed = seededrandom.setDecorationSeed(configFeatureSeed, blockposition.getX(), blockposition.getZ()); // See seededrandom.setDecorationSeed from above
|
||||
+ }
|
||||
|
Loading…
Reference in New Issue
Block a user