diff --git a/patches/server/Configurable-feature-seeds.patch b/patches/server/Configurable-feature-seeds.patch index d66e4e488a..75151bd30b 100644 --- a/patches/server/Configurable-feature-seeds.patch +++ b/patches/server/Configurable-feature-seeds.patch @@ -22,15 +22,6 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -0,0 +0,0 @@ public abstract class ChunkGenerator { - int j = list.size(); - - try { -- Registry iregistry1 = generatoraccessseed.registryAccess().registryOrThrow(Registry.PLACED_FEATURE_REGISTRY); -+ Registry 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) { @@ -0,0 +0,0 @@ public abstract class ChunkGenerator { return (String) optional.orElseGet(placedfeature::toString); }; @@ -38,8 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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 + } diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index 0e39a1bf3e..acc6d248c9 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -815,32 +815,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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/"""; + @@ -1083,6 +1081,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 +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..00000000000000000000000000000000 + +@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..00000000000000000000000000000000 + + public FeatureSeeds featureSeeds; + -+ public class FeatureSeeds extends ConfigurationPart { ++ public class FeatureSeeds extends ConfigurationPart.Post { + public boolean generateRandomSeedsForAll = false; + public Reference2LongMap>> 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;