aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/levelgen/FlatLevelSource.java.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-vineflower/net/minecraft/world/level/levelgen/FlatLevelSource.java.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/levelgen/FlatLevelSource.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/levelgen/FlatLevelSource.java.patch187
1 files changed, 187 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/levelgen/FlatLevelSource.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/levelgen/FlatLevelSource.java.patch
new file mode 100644
index 0000000000..655bb02775
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/levelgen/FlatLevelSource.java.patch
@@ -0,0 +1,187 @@
+--- a/net/minecraft/world/level/levelgen/FlatLevelSource.java
++++ b/net/minecraft/world/level/levelgen/FlatLevelSource.java
+@@ -2,8 +2,8 @@
+
+ import com.mojang.serialization.Codec;
+ import com.mojang.serialization.codecs.RecordCodecBuilder;
+-import com.mojang.serialization.codecs.RecordCodecBuilder.Instance;
+ import java.util.List;
++import java.util.Objects;
+ import java.util.concurrent.CompletableFuture;
+ import java.util.concurrent.Executor;
+ import java.util.stream.Stream;
+@@ -19,7 +19,7 @@
+ import net.minecraft.world.level.biome.BiomeManager;
+ import net.minecraft.world.level.biome.FixedBiomeSource;
+ import net.minecraft.world.level.block.Blocks;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.level.chunk.ChunkAccess;
+ import net.minecraft.world.level.chunk.ChunkGenerator;
+ import net.minecraft.world.level.chunk.ChunkGeneratorStructureState;
+@@ -28,29 +28,40 @@
+ import net.minecraft.world.level.levelgen.structure.StructureSet;
+
+ public class FlatLevelSource extends ChunkGenerator {
+- public static final Codec<FlatLevelSource> CODEC = RecordCodecBuilder.create(
+- instance -> instance.group(FlatLevelGeneratorSettings.CODEC.fieldOf("settings").forGetter(FlatLevelSource::settings))
+- .apply(instance, instance.stable(FlatLevelSource::new))
+- );
++
++ public static final Codec<FlatLevelSource> CODEC = RecordCodecBuilder.create((instance) -> {
++ return instance.group(FlatLevelGeneratorSettings.CODEC.fieldOf("settings").forGetter(FlatLevelSource::settings)).apply(instance, instance.stable(FlatLevelSource::new));
++ });
+ private final FlatLevelGeneratorSettings settings;
+
+ public FlatLevelSource(FlatLevelGeneratorSettings settings) {
+- super(new FixedBiomeSource(settings.getBiome()), Util.memoize(settings::adjustGenerationSettings));
+- this.settings = settings;
++ // CraftBukkit start
++ // WorldChunkManagerHell worldchunkmanagerhell = new WorldChunkManagerHell(generatorsettingsflat.getBiome());
++
++ // Objects.requireNonNull(generatorsettingsflat);
++ this(settings, new FixedBiomeSource(settings.getBiome()));
+ }
+
++ public FlatLevelSource(FlatLevelGeneratorSettings generatorsettingsflat, net.minecraft.world.level.biome.BiomeSource worldchunkmanager) {
++ super(worldchunkmanager, Util.memoize(generatorsettingsflat::adjustGenerationSettings));
++ // CraftBukkit end
++ this.settings = generatorsettingsflat;
++ }
++
+ @Override
+ public ChunkGeneratorStructureState createState(HolderLookup<StructureSet> structureSetLookup, RandomState randomState, long seed) {
+- Stream<Holder<StructureSet>> stream = this.settings
+- .structureOverrides()
+- .map(HolderSet::stream)
+- .orElseGet(() -> structureSetLookup.listElements().map(reference -> (Holder<StructureSet>)reference));
++ Stream<Holder<StructureSet>> stream = (Stream) this.settings.structureOverrides().map(HolderSet::stream).orElseGet(() -> {
++ return structureSetLookup.listElements().map((holder_c) -> {
++ return holder_c;
++ });
++ });
++
+ return ChunkGeneratorStructureState.createForFlat(randomState, seed, this.biomeSource, stream);
+ }
+
+ @Override
+ protected Codec<? extends ChunkGenerator> codec() {
+- return CODEC;
++ return FlatLevelSource.CODEC;
+ }
+
+ public FlatLevelGeneratorSettings settings() {
+@@ -58,8 +69,7 @@
+ }
+
+ @Override
+- public void buildSurface(WorldGenRegion level, StructureManager structureManager, RandomState random, ChunkAccess chunk) {
+- }
++ public void buildSurface(WorldGenRegion level, StructureManager structureManager, RandomState random, ChunkAccess chunk) {}
+
+ @Override
+ public int getSpawnHeight(LevelHeightAccessor level) {
+@@ -67,24 +77,23 @@
+ }
+
+ @Override
+- public CompletableFuture<ChunkAccess> fillFromNoise(
+- Executor executor, Blender blender, RandomState random, StructureManager structureManager, ChunkAccess chunk
+- ) {
+- List<BlockState> layers = this.settings.getLayers();
+- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+- Heightmap heightmapUnprimed = chunk.getOrCreateHeightmapUnprimed(Heightmap.Types.OCEAN_FLOOR_WG);
+- Heightmap heightmapUnprimed1 = chunk.getOrCreateHeightmapUnprimed(Heightmap.Types.WORLD_SURFACE_WG);
++ public CompletableFuture<ChunkAccess> fillFromNoise(Executor executor, Blender blender, RandomState random, StructureManager structureManager, ChunkAccess chunk) {
++ List<IBlockData> list = this.settings.getLayers();
++ BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
++ Heightmap heightmap = chunk.getOrCreateHeightmapUnprimed(Heightmap.Types.OCEAN_FLOOR_WG);
++ Heightmap heightmap1 = chunk.getOrCreateHeightmapUnprimed(Heightmap.Types.WORLD_SURFACE_WG);
+
+- for (int i = 0; i < Math.min(chunk.getHeight(), layers.size()); i++) {
+- BlockState blockState = layers.get(i);
+- if (blockState != null) {
+- int i1 = chunk.getMinBuildHeight() + i;
++ for (int i = 0; i < Math.min(chunk.getHeight(), list.size()); ++i) {
++ IBlockData iblockdata = (IBlockData) list.get(i);
+
+- for (int i2 = 0; i2 < 16; i2++) {
+- for (int i3 = 0; i3 < 16; i3++) {
+- chunk.setBlockState(mutableBlockPos.set(i2, i1, i3), blockState, false);
+- heightmapUnprimed.update(i2, i1, i3, blockState);
+- heightmapUnprimed1.update(i2, i1, i3, blockState);
++ if (iblockdata != null) {
++ int j = chunk.getMinBuildHeight() + i;
++
++ for (int k = 0; k < 16; ++k) {
++ for (int l = 0; l < 16; ++l) {
++ chunk.setBlockState(blockposition_mutableblockposition.set(k, j, l), iblockdata, false);
++ heightmap.update(k, j, l, iblockdata);
++ heightmap1.update(k, j, l, iblockdata);
+ }
+ }
+ }
+@@ -95,12 +104,13 @@
+
+ @Override
+ public int getBaseHeight(int x, int z, Heightmap.Types type, LevelHeightAccessor level, RandomState random) {
+- List<BlockState> layers = this.settings.getLayers();
++ List<IBlockData> list = this.settings.getLayers();
+
+- for (int i = Math.min(layers.size(), level.getMaxBuildHeight()) - 1; i >= 0; i--) {
+- BlockState blockState = layers.get(i);
+- if (blockState != null && type.isOpaque().test(blockState)) {
+- return level.getMinBuildHeight() + i + 1;
++ for (int k = Math.min(list.size(), level.getMaxBuildHeight()) - 1; k >= 0; --k) {
++ IBlockData iblockdata = (IBlockData) list.get(k);
++
++ if (iblockdata != null && type.isOpaque().test(iblockdata)) {
++ return level.getMinBuildHeight() + k + 1;
+ }
+ }
+
+@@ -109,36 +119,21 @@
+
+ @Override
+ public NoiseColumn getBaseColumn(int x, int z, LevelHeightAccessor height, RandomState random) {
+- return new NoiseColumn(
+- height.getMinBuildHeight(),
+- this.settings
+- .getLayers()
+- .stream()
+- .limit((long)height.getHeight())
+- .map(state -> state == null ? Blocks.AIR.defaultBlockState() : state)
+- .toArray(BlockState[]::new)
+- );
++ return new NoiseColumn(height.getMinBuildHeight(), (IBlockData[]) this.settings.getLayers().stream().limit((long) height.getHeight()).map((iblockdata) -> {
++ return iblockdata == null ? Blocks.AIR.defaultBlockState() : iblockdata;
++ }).toArray((k) -> {
++ return new IBlockData[k];
++ }));
+ }
+
+ @Override
+- public void addDebugScreenInfo(List<String> info, RandomState random, BlockPos pos) {
+- }
++ public void addDebugScreenInfo(List<String> info, RandomState random, BlockPos pos) {}
+
+ @Override
+- public void applyCarvers(
+- WorldGenRegion level,
+- long seed,
+- RandomState random,
+- BiomeManager biomeManager,
+- StructureManager structureManager,
+- ChunkAccess chunk,
+- GenerationStep.Carving step
+- ) {
+- }
++ public void applyCarvers(WorldGenRegion level, long seed, RandomState randomstate, BiomeManager random, StructureManager biomeManager, ChunkAccess structureManager, GenerationStep.Carving chunk) {}
+
+ @Override
+- public void spawnOriginalMobs(WorldGenRegion level) {
+- }
++ public void spawnOriginalMobs(WorldGenRegion level) {}
+
+ @Override
+ public int getMinY() {