mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
fixed flat bedrock patch
This commit is contained in:
parent
2749c38c43
commit
753ac9ce84
2 changed files with 34 additions and 7 deletions
|
@ -277,7 +277,7 @@ public org.bukkit.craftbukkit.profile.CraftPlayerProfile toString(Lcom/mojang/au
|
||||||
public org.bukkit.craftbukkit.profile.CraftPlayerProfile equals(Lcom/mojang/authlib/properties/PropertyMap;Lcom/mojang/authlib/properties/PropertyMap;)Z
|
public org.bukkit.craftbukkit.profile.CraftPlayerProfile equals(Lcom/mojang/authlib/properties/PropertyMap;Lcom/mojang/authlib/properties/PropertyMap;)Z
|
||||||
public org.bukkit.craftbukkit.profile.CraftPlayerProfile hashCode(Lcom/mojang/authlib/properties/PropertyMap;)I
|
public org.bukkit.craftbukkit.profile.CraftPlayerProfile hashCode(Lcom/mojang/authlib/properties/PropertyMap;)I
|
||||||
|
|
||||||
# Generator Settings
|
# Flat bedrock generator settings
|
||||||
public net.minecraft.world.level.levelgen.SurfaceRules$Condition
|
public net.minecraft.world.level.levelgen.SurfaceRules$Condition
|
||||||
public net.minecraft.world.level.levelgen.SurfaceRules$Context
|
public net.minecraft.world.level.levelgen.SurfaceRules$Context
|
||||||
public net.minecraft.world.level.levelgen.SurfaceRules$Context blockX
|
public net.minecraft.world.level.levelgen.SurfaceRules$Context blockX
|
||||||
|
|
|
@ -30,7 +30,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ // Taken from SurfaceRules$VerticalGradientConditionSource
|
+ // Taken from SurfaceRules$VerticalGradientConditionSource
|
||||||
+ private final record PaperBedrockConditionSource(String randomName, VerticalAnchor trueAtAndBelow, VerticalAnchor falseAtAndAbove, boolean invert) implements SurfaceRules.ConditionSource {
|
+ // isRoof = true if roof, false if floor
|
||||||
|
+ public record PaperBedrockConditionSource(net.minecraft.resources.ResourceLocation randomName, VerticalAnchor trueAtAndBelow, VerticalAnchor falseAtAndAbove, boolean isRoof) implements SurfaceRules.ConditionSource {
|
||||||
|
+
|
||||||
|
+ public static final com.mojang.serialization.Codec<PaperBedrockConditionSource> CODEC = com.mojang.serialization.codecs.RecordCodecBuilder.create((instance) -> {
|
||||||
|
+ return instance.group(
|
||||||
|
+ net.minecraft.resources.ResourceLocation.CODEC.fieldOf("random_name").forGetter(PaperBedrockConditionSource::randomName),
|
||||||
|
+ VerticalAnchor.CODEC.fieldOf("true_at_and_below").forGetter(PaperBedrockConditionSource::trueAtAndBelow),
|
||||||
|
+ VerticalAnchor.CODEC.fieldOf("false_at_and_above").forGetter(PaperBedrockConditionSource::falseAtAndAbove),
|
||||||
|
+ com.mojang.serialization.Codec.BOOL.fieldOf("roof").forGetter(PaperBedrockConditionSource::isRoof)
|
||||||
|
+ ).apply(instance, PaperBedrockConditionSource::new);
|
||||||
|
+ });
|
||||||
|
+
|
||||||
|
+ public PaperBedrockConditionSource(String randomName, net.minecraft.world.level.levelgen.VerticalAnchor trueAtAndBelow, net.minecraft.world.level.levelgen.VerticalAnchor falseAtAndAbove, boolean invert) {
|
||||||
|
+ this(new net.minecraft.resources.ResourceLocation(randomName), trueAtAndBelow, falseAtAndAbove, invert);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public com.mojang.serialization.Codec<? extends SurfaceRules.ConditionSource> codec() {
|
+ public com.mojang.serialization.Codec<? extends SurfaceRules.ConditionSource> codec() {
|
||||||
+ return CODEC;
|
+ return CODEC;
|
||||||
|
@ -42,10 +57,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ int trueAtY = this.trueAtAndBelow().resolveY(context.context);
|
+ int trueAtY = this.trueAtAndBelow().resolveY(context.context);
|
||||||
+ int falseAtY = this.falseAtAndAbove().resolveY(context.context);
|
+ int falseAtY = this.falseAtAndAbove().resolveY(context.context);
|
||||||
+
|
+
|
||||||
+ int y = invert ? Math.max(falseAtY, trueAtY) - 1 : Math.min(falseAtY, trueAtY) ;
|
+ int y = isRoof ? Math.max(falseAtY, trueAtY) - 1 : Math.min(falseAtY, trueAtY) ;
|
||||||
+ final int i = hasFlatBedrock ? y : trueAtY;
|
+ final int i = hasFlatBedrock ? y : trueAtY;
|
||||||
+ final int j = hasFlatBedrock ? y : falseAtY;
|
+ final int j = hasFlatBedrock ? y : falseAtY;
|
||||||
+ final net.minecraft.world.level.levelgen.PositionalRandomFactory positionalRandomFactory = context.system.getOrCreateRandomFactory(new net.minecraft.resources.ResourceLocation(this.randomName()));
|
+ final net.minecraft.world.level.levelgen.PositionalRandomFactory positionalRandomFactory = context.system.getOrCreateRandomFactory(this.randomName());
|
||||||
+
|
+
|
||||||
+ class VerticalGradientCondition extends SurfaceRules.LazyYCondition {
|
+ class VerticalGradientCondition extends SurfaceRules.LazyYCondition {
|
||||||
+ VerticalGradientCondition(SurfaceRules.Context context) {
|
+ VerticalGradientCondition(SurfaceRules.Context context) {
|
||||||
|
@ -98,6 +113,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SurfaceRules.RuleSource end() {
|
public static SurfaceRules.RuleSource end() {
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/Bootstrap.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/Bootstrap.java
|
||||||
|
@@ -0,0 +0,0 @@ public class Bootstrap {
|
||||||
|
DispenseItemBehavior.bootStrap();
|
||||||
|
CauldronInteraction.bootStrap();
|
||||||
|
ArgumentTypes.bootStrap();
|
||||||
|
+ Registry.register(net.minecraft.core.Registry.CONDITION, new net.minecraft.resources.ResourceLocation("paper", "bedrock_condition_source"), net.minecraft.data.worldgen.SurfaceRuleData.PaperBedrockConditionSource.CODEC); // Paper - register custom flat bedrock thing. TODO is this the best place to do this?
|
||||||
|
Registry.freezeBuiltins();
|
||||||
|
Bootstrap.wrapStreams();
|
||||||
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||||
|
@ -107,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
public void buildSurface(WorldGenRegion region, StructureFeatureManager structures, ChunkAccess chunk) {
|
public void buildSurface(WorldGenRegion region, StructureFeatureManager structures, ChunkAccess chunk) {
|
||||||
if (!SharedConstants.debugVoidTerrain(chunk.getPos())) {
|
if (!SharedConstants.debugVoidTerrain(chunk.getPos())) {
|
||||||
- WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region);
|
- WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region);
|
||||||
+ WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region, region.getLevel()); // Paper
|
+ WorldGenerationContext worldgenerationcontext = new WorldGenerationContext(this, region, region.getMinecraftWorld()); // Paper
|
||||||
NoiseGeneratorSettings generatorsettingbase = (NoiseGeneratorSettings) this.settings.value();
|
NoiseGeneratorSettings generatorsettingbase = (NoiseGeneratorSettings) this.settings.value();
|
||||||
NoiseChunk noisechunk = chunk.getOrCreateNoiseChunk(this.router, () -> {
|
NoiseChunk noisechunk = chunk.getOrCreateNoiseChunk(this.router, () -> {
|
||||||
return new Beardifier(structures, chunk);
|
return new Beardifier(structures, chunk);
|
||||||
|
@ -116,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}, (NoiseGeneratorSettings) this.settings.value(), this.globalFluidPicker, Blender.of(chunkRegion));
|
}, (NoiseGeneratorSettings) this.settings.value(), this.globalFluidPicker, Blender.of(chunkRegion));
|
||||||
Aquifer aquifer = noisechunk.aquifer();
|
Aquifer aquifer = noisechunk.aquifer();
|
||||||
- CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk);
|
- CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk);
|
||||||
+ CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, chunkRegion.getLevel()); // Paper
|
+ CarvingContext carvingcontext = new CarvingContext(this, chunkRegion.registryAccess(), chunk.getHeightAccessorForGeneration(), noisechunk, chunkRegion.getMinecraftWorld()); // Paper
|
||||||
CarvingMask carvingmask = ((ProtoChunk) chunk).getOrCreateCarvingMask(generationStep);
|
CarvingMask carvingmask = ((ProtoChunk) chunk).getOrCreateCarvingMask(generationStep);
|
||||||
|
|
||||||
for (int j = -8; j <= 8; ++j) {
|
for (int j = -8; j <= 8; ++j) {
|
||||||
|
@ -128,7 +155,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
public class WorldGenerationContext {
|
public class WorldGenerationContext {
|
||||||
private final int minY;
|
private final int minY;
|
||||||
private final int height;
|
private final int height;
|
||||||
+ private final net.minecraft.world.level.Level level; // Paper
|
+ private final @javax.annotation.Nullable net.minecraft.world.level.Level level; // Paper
|
||||||
|
|
||||||
- public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) {
|
- public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) {
|
||||||
+ public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) { this(generator, world, null); } // Paper
|
+ public WorldGenerationContext(ChunkGenerator generator, LevelHeightAccessor world) { this(generator, world, null); } // Paper
|
||||||
|
|
Loading…
Reference in a new issue