From 380bbb836de26372e9b07de2968e11fa01366b59 Mon Sep 17 00:00:00 2001 From: SD Date: Sat, 15 Aug 2020 08:25:35 +0530 Subject: [PATCH] Moved dimension jsons Changes to be committed: modified: src/main/java/org/dimdev/dimdoors/world/ModDimensions.java modified: src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java renamed: src/main/resources/data/dimdoors/dimension/dimdoors/dungeon_pockets.json -> src/main/resources/data/dimdoors/dimension/dungeon_pockets.json renamed: src/main/resources/data/dimdoors/dimension/dimdoors/limbo.json -> src/main/resources/data/dimdoors/dimension/limbo.json renamed: src/main/resources/data/dimdoors/dimension/dimdoors/personal_pockets.json -> src/main/resources/data/dimdoors/dimension/personal_pockets.json renamed: src/main/resources/data/dimdoors/dimension/dimdoors/public_pockets.json -> src/main/resources/data/dimdoors/dimension/public_pockets.json renamed: src/main/resources/data/dimdoors/dimension_type/dimdoors/limbo.json -> src/main/resources/data/dimdoors/dimension_type/limbo.json renamed: src/main/resources/data/dimdoors/dimension_type/dimdoors/pocket.json -> src/main/resources/data/dimdoors/dimension_type/pocket.json --- .../dimdev/dimdoors/world/ModDimensions.java | 1 - .../world/limbo/LimboChunkGenerator.java | 98 ++++++++----------- .../{dimdoors => }/dungeon_pockets.json | 0 .../dimension/{dimdoors => }/limbo.json | 4 +- .../{dimdoors => }/personal_pockets.json | 0 .../{dimdoors => }/public_pockets.json | 0 .../dimension_type/{dimdoors => }/limbo.json | 0 .../dimension_type/{dimdoors => }/pocket.json | 0 8 files changed, 42 insertions(+), 61 deletions(-) rename src/main/resources/data/dimdoors/dimension/{dimdoors => }/dungeon_pockets.json (100%) rename src/main/resources/data/dimdoors/dimension/{dimdoors => }/limbo.json (96%) rename src/main/resources/data/dimdoors/dimension/{dimdoors => }/personal_pockets.json (100%) rename src/main/resources/data/dimdoors/dimension/{dimdoors => }/public_pockets.json (100%) rename src/main/resources/data/dimdoors/dimension_type/{dimdoors => }/limbo.json (100%) rename src/main/resources/data/dimdoors/dimension_type/{dimdoors => }/pocket.json (100%) diff --git a/src/main/java/org/dimdev/dimdoors/world/ModDimensions.java b/src/main/java/org/dimdev/dimdoors/world/ModDimensions.java index db6156d6..e6a34437 100644 --- a/src/main/java/org/dimdev/dimdoors/world/ModDimensions.java +++ b/src/main/java/org/dimdev/dimdoors/world/ModDimensions.java @@ -30,6 +30,5 @@ public final class ModDimensions { public static void init() { Registry.register(Registry.CHUNK_GENERATOR, new Identifier("dimdoors", "blank"), BlankChunkGenerator.CODEC); Registry.register(Registry.CHUNK_GENERATOR, new Identifier("dimdoors", "limbo"), LimboChunkGenerator.CODEC); - // just loads the class } } diff --git a/src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java b/src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java index 6f0b9ff1..27d9a37f 100644 --- a/src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java +++ b/src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java @@ -55,16 +55,9 @@ import net.minecraft.world.gen.feature.StructureFeature; import org.dimdev.dimdoors.mixin.ChunkGeneratorSettingsAccessor; import org.jetbrains.annotations.Nullable; -public final class LimboChunkGenerator extends ChunkGenerator { - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> { - return instance.group(BiomeSource.CODEC.fieldOf("biome_source").forGetter((noiseChunkGenerator) -> { - return noiseChunkGenerator.biomeSource; - }), Codec.LONG.fieldOf("seed").stable().forGetter((noiseChunkGenerator) -> { - return new Random().nextLong(); - }), ChunkGeneratorSettings.REGISTRY_CODEC.fieldOf("settings").forGetter((noiseChunkGenerator) -> { - return noiseChunkGenerator.settings; - })).apply(instance, instance.stable(LimboChunkGenerator::new)); - }); +@SuppressWarnings("deprecated") +public class LimboChunkGenerator extends ChunkGenerator { + public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance.group(BiomeSource.CODEC.fieldOf("biome_source").forGetter((noiseChunkGenerator) -> noiseChunkGenerator.biomeSource), Codec.LONG.fieldOf("seed").stable().forGetter((noiseChunkGenerator) -> new Random().nextLong()), ChunkGeneratorSettings.REGISTRY_CODEC.fieldOf("settings").forGetter((noiseChunkGenerator) -> noiseChunkGenerator.settings)).apply(instance, instance.stable(LimboChunkGenerator::new))); private static final float[] NOISE_WEIGHT_TABLE = Util.make(new float[13824], (array) -> { for(int i = 0; i < 24; ++i) { for(int j = 0; j < 24; ++j) { @@ -104,13 +97,13 @@ public final class LimboChunkGenerator extends ChunkGenerator { protected final Supplier settings; private final int worldHeight; - public LimboChunkGenerator(BiomeSource biomeSource, long l, Supplier supplier) { - this(biomeSource, biomeSource, l, supplier); + public LimboChunkGenerator(BiomeSource biomeSource, long seed, Supplier supplier) { + this(biomeSource, biomeSource, seed, supplier); } - private LimboChunkGenerator(BiomeSource biomeSource, BiomeSource biomeSource2, long worldSeed, Supplier supplier) { - super(biomeSource, biomeSource2, supplier.get().getStructuresConfig(), worldSeed); - this.worldSeed = worldSeed; + private LimboChunkGenerator(BiomeSource biomeSource, BiomeSource biomeSource2, long seed, Supplier supplier) { + super(biomeSource, biomeSource2, supplier.get().getStructuresConfig(), seed); + this.worldSeed = seed; ChunkGeneratorSettings chunkGeneratorSettings = supplier.get(); this.settings = supplier; GenerationShapeConfig generationShapeConfig = chunkGeneratorSettings.getGenerationShapeConfig(); @@ -122,7 +115,7 @@ public final class LimboChunkGenerator extends ChunkGenerator { this.noiseSizeX = 16 / this.horizontalNoiseResolution; this.noiseSizeY = generationShapeConfig.getHeight() / this.verticalNoiseResolution; this.noiseSizeZ = 16 / this.horizontalNoiseResolution; - this.random = new ChunkRandom(worldSeed); + this.random = new ChunkRandom(seed); this.lowerInterpolatedNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-15, 0)); this.upperInterpolatedNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-15, 0)); this.interpolationNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-7, 0)); @@ -130,7 +123,7 @@ public final class LimboChunkGenerator extends ChunkGenerator { this.random.consume(2620); this.densityNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-15, 0)); if (generationShapeConfig.hasIslandNoiseOverride()) { - ChunkRandom chunkRandom = new ChunkRandom(worldSeed); + ChunkRandom chunkRandom = new ChunkRandom(seed); chunkRandom.consume(17292); this.islandNoise = new SimplexNoiseSampler(chunkRandom); } else { @@ -148,7 +141,7 @@ public final class LimboChunkGenerator extends ChunkGenerator { return new LimboChunkGenerator(this.biomeSource.withSeed(seed), seed, this.settings); } - public boolean method_28548(long l, RegistryKey registryKey) { + public boolean equals(long l, RegistryKey registryKey) { return this.worldSeed == l && this.settings.get().equals(registryKey); } @@ -156,7 +149,6 @@ public final class LimboChunkGenerator extends ChunkGenerator { double d = 0.0D; double e = 0.0D; double f = 0.0D; - boolean bl = true; double g = 1.0D; for(int i = 0; i < 16; ++i) { @@ -210,7 +202,6 @@ public final class LimboChunkGenerator extends ChunkGenerator { float g = 0.0F; float h = 0.0F; float i = 0.0F; - int j = 1; int k = this.getSeaLevel(); float l = this.biomeSource.getBiomeForNoiseGen(x, k, z).getDepth(); @@ -368,7 +359,6 @@ public final class LimboChunkGenerator extends ChunkGenerator { ChunkPos chunkPos2 = chunk.getPos(); int k = chunkPos2.getStartX(); int l = chunkPos2.getStartZ(); - double d = 0.0625D; BlockPos.Mutable mutable = new BlockPos.Mutable(); for(int m = 0; m < 16; ++m) { @@ -391,7 +381,6 @@ public final class LimboChunkGenerator extends ChunkGenerator { ChunkGeneratorSettings chunkGeneratorSettings = this.settings.get(); int k = chunkGeneratorSettings.getBedrockFloorY(); int l = this.worldHeight - 1 - chunkGeneratorSettings.getBedrockCeilingY(); - int m = 1; boolean bl = l + 4 >= 0 && l < this.worldHeight; boolean bl2 = k + 4 >= 0 && k < this.worldHeight; if (bl || bl2) { @@ -425,51 +414,44 @@ public final class LimboChunkGenerator extends ChunkGenerator { } public void populateNoise(WorldAccess world, StructureAccessor accessor, Chunk chunk) { - ObjectList objectList = new ObjectArrayList(10); - ObjectList objectList2 = new ObjectArrayList(32); + ObjectList objectList = new ObjectArrayList<>(10); + ObjectList objectList2 = new ObjectArrayList<>(32); ChunkPos chunkPos = chunk.getPos(); int i = chunkPos.x; int j = chunkPos.z; int k = i << 4; int l = j << 4; - Iterator var11 = StructureFeature.JIGSAW_STRUCTURES.iterator(); - while(var11.hasNext()) { - StructureFeature structureFeature = (StructureFeature)var11.next(); + for (StructureFeature structureFeature : StructureFeature.JIGSAW_STRUCTURES) { accessor.getStructuresWithChildren(ChunkSectionPos.from(chunkPos, 0), structureFeature).forEach((start) -> { - Iterator var6 = start.getChildren().iterator(); + Iterator var6 = start.getChildren().iterator(); - while(true) { - while(true) { - StructurePiece structurePiece; - do { - if (!var6.hasNext()) { - return; - } - - structurePiece = (StructurePiece)var6.next(); - } while(!structurePiece.intersectsChunk(chunkPos, 12)); - - if (structurePiece instanceof PoolStructurePiece) { - PoolStructurePiece poolStructurePiece = (PoolStructurePiece)structurePiece; - StructurePool.Projection projection = poolStructurePiece.getPoolElement().getProjection(); - if (projection == StructurePool.Projection.RIGID) { - objectList.add(poolStructurePiece); - } - - Iterator var10 = poolStructurePiece.getJunctions().iterator(); - - while(var10.hasNext()) { - JigsawJunction jigsawJunction = (JigsawJunction)var10.next(); - int kx = jigsawJunction.getSourceX(); - int lx = jigsawJunction.getSourceZ(); - if (kx > k - 12 && lx > l - 12 && kx < k + 15 + 12 && lx < l + 15 + 12) { - objectList2.add(jigsawJunction); - } - } - } else { - objectList.add(structurePiece); + while (true) { + StructurePiece structurePiece; + do { + if (!var6.hasNext()) { + return; } + + structurePiece = var6.next(); + } while (!structurePiece.intersectsChunk(chunkPos, 12)); + + if (structurePiece instanceof PoolStructurePiece) { + PoolStructurePiece poolStructurePiece = (PoolStructurePiece) structurePiece; + StructurePool.Projection projection = poolStructurePiece.getPoolElement().getProjection(); + if (projection == StructurePool.Projection.RIGID) { + objectList.add(poolStructurePiece); + } + + for (JigsawJunction jigsawJunction : poolStructurePiece.getJunctions()) { + int kx = jigsawJunction.getSourceX(); + int lx = jigsawJunction.getSourceZ(); + if (kx > k - 12 && lx > l - 12 && kx < k + 15 + 12 && lx < l + 15 + 12) { + objectList2.add(jigsawJunction); + } + } + } else { + objectList.add(structurePiece); } } }); diff --git a/src/main/resources/data/dimdoors/dimension/dimdoors/dungeon_pockets.json b/src/main/resources/data/dimdoors/dimension/dungeon_pockets.json similarity index 100% rename from src/main/resources/data/dimdoors/dimension/dimdoors/dungeon_pockets.json rename to src/main/resources/data/dimdoors/dimension/dungeon_pockets.json diff --git a/src/main/resources/data/dimdoors/dimension/dimdoors/limbo.json b/src/main/resources/data/dimdoors/dimension/limbo.json similarity index 96% rename from src/main/resources/data/dimdoors/dimension/dimdoors/limbo.json rename to src/main/resources/data/dimdoors/dimension/limbo.json index d74a739f..5452a9d5 100644 --- a/src/main/resources/data/dimdoors/dimension/dimdoors/limbo.json +++ b/src/main/resources/data/dimdoors/dimension/limbo.json @@ -1,7 +1,7 @@ { "type": "dimdoors:limbo", "generator": { - "type": "minecraft:noise", + "type": "minecraft:limbo", "seed": 341873128713, "biome_source": { "type": "minecraft:multi_noise", @@ -10,7 +10,7 @@ { "parameters": { "altitude": 0.00, - "weirdness": -0.5, + "weirdness": 2.5, "offset": 1.00, "temperature": 0.00, "humidity": 0.00 diff --git a/src/main/resources/data/dimdoors/dimension/dimdoors/personal_pockets.json b/src/main/resources/data/dimdoors/dimension/personal_pockets.json similarity index 100% rename from src/main/resources/data/dimdoors/dimension/dimdoors/personal_pockets.json rename to src/main/resources/data/dimdoors/dimension/personal_pockets.json diff --git a/src/main/resources/data/dimdoors/dimension/dimdoors/public_pockets.json b/src/main/resources/data/dimdoors/dimension/public_pockets.json similarity index 100% rename from src/main/resources/data/dimdoors/dimension/dimdoors/public_pockets.json rename to src/main/resources/data/dimdoors/dimension/public_pockets.json diff --git a/src/main/resources/data/dimdoors/dimension_type/dimdoors/limbo.json b/src/main/resources/data/dimdoors/dimension_type/limbo.json similarity index 100% rename from src/main/resources/data/dimdoors/dimension_type/dimdoors/limbo.json rename to src/main/resources/data/dimdoors/dimension_type/limbo.json diff --git a/src/main/resources/data/dimdoors/dimension_type/dimdoors/pocket.json b/src/main/resources/data/dimdoors/dimension_type/pocket.json similarity index 100% rename from src/main/resources/data/dimdoors/dimension_type/dimdoors/pocket.json rename to src/main/resources/data/dimdoors/dimension_type/pocket.json