made a seperate BiomeSource for limbo

cos why not

 Changes to be committed:
	modified:   src/main/java/org/dimdev/dimdoors/world/ModBiomes.java
	modified:   src/main/java/org/dimdev/dimdoors/world/ModDimensions.java
	new file:   src/main/java/org/dimdev/dimdoors/world/limbo/LimboBiomeSource.java
	modified:   src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java
	modified:   src/main/resources/data/dimdoors/dimension/dungeon_pockets.json
	modified:   src/main/resources/data/dimdoors/dimension/limbo.json
	modified:   src/main/resources/data/dimdoors/dimension/personal_pockets.json
	modified:   src/main/resources/data/dimdoors/dimension/public_pockets.json
	modified:   src/main/resources/data/dimdoors/temp/limbo.json
This commit is contained in:
SD 2020-08-18 16:18:07 +05:30
parent 7294ed49ea
commit 7a70268b41
No known key found for this signature in database
GPG key ID: E36B57EE08544BC5
9 changed files with 52 additions and 70 deletions

View file

@ -30,9 +30,7 @@ public final class ModBiomes {
public static void init() { public static void init() {
int id = 1; int id = 1;
for (Biome ignored : BuiltinRegistries.BIOME) { id += BuiltinRegistries.BIOME.stream().count();
id++;
}
BuiltinBiomesAccessor.invokeRegister(id + 1, LIMBO_KEY, LIMBO_BIOME); BuiltinBiomesAccessor.invokeRegister(id + 1, LIMBO_KEY, LIMBO_BIOME);
BuiltinBiomesAccessor.invokeRegister(id + 2, PERSONAL_WHITE_VOID_KEY, WHITE_VOID_BIOME); BuiltinBiomesAccessor.invokeRegister(id + 2, PERSONAL_WHITE_VOID_KEY, WHITE_VOID_BIOME);
BuiltinBiomesAccessor.invokeRegister(id + 3, PUBLIC_BLACK_VOID_KEY, BLACK_VOID_BIOME); BuiltinBiomesAccessor.invokeRegister(id + 3, PUBLIC_BLACK_VOID_KEY, BLACK_VOID_BIOME);
@ -58,11 +56,9 @@ public final class ModBiomes {
.waterFogColor(0) .waterFogColor(0)
.moodSound(new BiomeMoodSound(ModSoundEvents.CREEPY, 6000, 8, 2.0)) .moodSound(new BiomeMoodSound(ModSoundEvents.CREEPY, 6000, 8, 2.0))
.skyColor(0x404040) .skyColor(0x404040)
.grassColorModifier(BiomeEffects.GrassColorModifier.NONE)
.grassColor(0)
.build()) .build())
.generationSettings(new GenerationSettings.Builder() .generationSettings(new GenerationSettings.Builder()
.surfaceBuilder(SurfaceBuilder.DEFAULT.method_30478(new TernarySurfaceConfig(ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.ETERNAL_FLUID.getDefaultState()))) .surfaceBuilder(SurfaceBuilder.NETHER.method_30478(new TernarySurfaceConfig(ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.ETERNAL_FLUID.getDefaultState())))
.build()) .build())
.precipitation(Biome.Precipitation.NONE) .precipitation(Biome.Precipitation.NONE)
.scale(0.9f) .scale(0.9f)

View file

@ -1,5 +1,6 @@
package org.dimdev.dimdoors.world; package org.dimdev.dimdoors.world;
import org.dimdev.dimdoors.world.limbo.LimboBiomeSource;
import org.dimdev.dimdoors.world.limbo.LimboChunkGenerator; import org.dimdev.dimdoors.world.limbo.LimboChunkGenerator;
import org.dimdev.dimdoors.world.pocket.BlankChunkGenerator; import org.dimdev.dimdoors.world.pocket.BlankChunkGenerator;
@ -15,8 +16,8 @@ public final class ModDimensions {
public static final RegistryKey<World> PUBLIC = RegistryKey.of(Registry.DIMENSION, new Identifier("dimdoors:public_pockets")); public static final RegistryKey<World> PUBLIC = RegistryKey.of(Registry.DIMENSION, new Identifier("dimdoors:public_pockets"));
public static final RegistryKey<World> DUNGEON = RegistryKey.of(Registry.DIMENSION, new Identifier("dimdoors:dungeon_pockets")); public static final RegistryKey<World> DUNGEON = RegistryKey.of(Registry.DIMENSION, new Identifier("dimdoors:dungeon_pockets"));
public static final RegistryKey<DimensionType> LIMBO_TYPE = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, new Identifier("dimdoors:limbo")); public static final RegistryKey<DimensionType> LIMBO_TYPE_KEY = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, new Identifier("dimdoors:limbo"));
public static final RegistryKey<DimensionType> POCKET_TYPE = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, new Identifier("dimdoors:personal_pockets")); public static final RegistryKey<DimensionType> POCKET_TYPE_KEY = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, new Identifier("dimdoors:personal_pockets"));
public static boolean isDimDoorsPocketDimension(World world) { public static boolean isDimDoorsPocketDimension(World world) {
RegistryKey<World> type = world.getRegistryKey(); RegistryKey<World> type = world.getRegistryKey();
@ -29,6 +30,7 @@ public final class ModDimensions {
public static void init() { public static void init() {
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("dimdoors", "blank"), BlankChunkGenerator.CODEC); Registry.register(Registry.CHUNK_GENERATOR, new Identifier("dimdoors", "blank"), BlankChunkGenerator.CODEC);
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("dimdoors", "limbo"), LimboChunkGenerator.CODEC); Registry.register(Registry.CHUNK_GENERATOR, new Identifier("dimdoors", "limbo_chunk_generator"), LimboChunkGenerator.CODEC);
Registry.register(Registry.BIOME_SOURCE, new Identifier("dimdoors", "limbo_biome_source"), LimboBiomeSource.CODEC);
} }
} }

View file

@ -0,0 +1,35 @@
package org.dimdev.dimdoors.world.limbo;
import java.util.Collections;
import com.mojang.serialization.Codec;
import com.mojang.serialization.Decoder;
import com.mojang.serialization.Encoder;
import com.mojang.serialization.MapCodec;
import org.dimdev.dimdoors.world.ModBiomes;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeSource;
public class LimboBiomeSource extends BiomeSource {
public static final Codec<LimboBiomeSource> CODEC = MapCodec.of(Encoder.empty(), Decoder.unit(LimboBiomeSource::new)).stable().codec();
public LimboBiomeSource() {
super(Collections.singletonList(ModBiomes.LIMBO_BIOME));
}
@Override
public Codec<? extends BiomeSource> getCodec() {
return CODEC;
}
@Override
public BiomeSource withSeed(long seed) {
return this;
}
@Override
public Biome getBiomeForNoiseGen(int biomeX, int biomeY, int biomeZ) {
return ModBiomes.LIMBO_BIOME;
}
}

View file

@ -59,8 +59,6 @@ public class LimboChunkGenerator extends ChunkGenerator {
public static final Codec<LimboChunkGenerator> CODEC = RecordCodecBuilder.create((instance) -> { public static final Codec<LimboChunkGenerator> CODEC = RecordCodecBuilder.create((instance) -> {
return instance.group(BiomeSource.CODEC.fieldOf("biome_source").forGetter((limboChunkGenerator) -> { return instance.group(BiomeSource.CODEC.fieldOf("biome_source").forGetter((limboChunkGenerator) -> {
return limboChunkGenerator.biomeSource; return limboChunkGenerator.biomeSource;
}), Codec.LONG.fieldOf("seed").stable().forGetter((limboChunkGenerator) -> {
return limboChunkGenerator.worldSeed;
}), ChunkGeneratorSettings.REGISTRY_CODEC.fieldOf("settings").forGetter((limboChunkGenerator) -> { }), ChunkGeneratorSettings.REGISTRY_CODEC.fieldOf("settings").forGetter((limboChunkGenerator) -> {
return limboChunkGenerator.settings; return limboChunkGenerator.settings;
})).apply(instance, instance.stable(LimboChunkGenerator::new)); })).apply(instance, instance.stable(LimboChunkGenerator::new));
@ -105,11 +103,11 @@ public class LimboChunkGenerator extends ChunkGenerator {
protected final Supplier<ChunkGeneratorSettings> settings; protected final Supplier<ChunkGeneratorSettings> settings;
private final int worldHeight; private final int worldHeight;
public LimboChunkGenerator(BiomeSource biomeSource, long seed, Supplier<ChunkGeneratorSettings> supplier) { public LimboChunkGenerator(BiomeSource biomeSource, Supplier<ChunkGeneratorSettings> supplier) {
this(biomeSource, biomeSource, seed, supplier); this(biomeSource, biomeSource, supplier);
} }
private LimboChunkGenerator(BiomeSource biomeSource, BiomeSource biomeSource2, long seed, Supplier<ChunkGeneratorSettings> supplier) { private LimboChunkGenerator(BiomeSource biomeSource, BiomeSource biomeSource2, Supplier<ChunkGeneratorSettings> supplier) {
super(biomeSource, biomeSource2, supplier.get().getStructuresConfig(), new Random().nextLong()); super(biomeSource, biomeSource2, supplier.get().getStructuresConfig(), new Random().nextLong());
this.worldSeed = new Random().nextLong(); this.worldSeed = new Random().nextLong();
ChunkGeneratorSettings chunkGeneratorSettings = supplier.get(); ChunkGeneratorSettings chunkGeneratorSettings = supplier.get();
@ -146,7 +144,7 @@ public class LimboChunkGenerator extends ChunkGenerator {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public ChunkGenerator withSeed(long seed) { public ChunkGenerator withSeed(long seed) {
return new LimboChunkGenerator(this.biomeSource.withSeed(seed), seed, this.settings); return new LimboChunkGenerator(this.biomeSource.withSeed(seed), this.settings);
} }
public boolean equals(long l, RegistryKey<ChunkGeneratorSettings> registryKey) { public boolean equals(long l, RegistryKey<ChunkGeneratorSettings> registryKey) {

View file

@ -3,7 +3,7 @@
"type": "dimdoors:blank", "type": "dimdoors:blank",
"biome_source": { "biome_source": {
"type": "minecraft:fixed", "type": "minecraft:fixed",
"biome": "dimdoors:limbo" "biome": "dimdoors:dangerous_black_void"
} }
}, },
"type": "dimdoors:pocket" "type": "dimdoors:pocket"

View file

@ -1,11 +1,9 @@
{ {
"type": "dimdoors:limbo", "type": "dimdoors:limbo",
"generator": { "generator": {
"type": "minecraft:noise", "type": "dimdoors:limbo_chunk_generator",
"seed": 23123456787659,
"biome_source": { "biome_source": {
"type": "minecraft:fixed", "type": "dimdoors:limbo_biome_source"
"biome": "dimdoors:limbo"
}, },
"settings": { "settings": {
"bedrock_floor_position": 0, "bedrock_floor_position": 0,

View file

@ -3,7 +3,7 @@
"type": "dimdoors:blank", "type": "dimdoors:blank",
"biome_source": { "biome_source": {
"type": "minecraft:fixed", "type": "minecraft:fixed",
"biome": "dimdoors:limbo" "biome": "dimdoors:white_void"
} }
}, },
"type": "dimdoors:pocket" "type": "dimdoors:pocket"

View file

@ -3,7 +3,7 @@
"type": "dimdoors:blank", "type": "dimdoors:blank",
"biome_source": { "biome_source": {
"type": "minecraft:fixed", "type": "minecraft:fixed",
"biome": "dimdoors:limbo" "biome": "dimdoors:black_void"
} }
}, },
"type": "dimdoors:pocket" "type": "dimdoors:pocket"

View file

@ -36,54 +36,7 @@
[], [],
[], [],
[], [],
[ []
{
"config": {
"feature": {
"config": {
"feature": {
"config": {
"feature": {
"config": {
"target": {
"block": "minecraft:bedrock",
"predicate_type": "minecraft:block_match"
},
"state": {
"Name": "dimdoors:eternal_fluid"
},
"size": 3
},
"type": "minecraft:ore"
},
"decorator": {
"config": {
"bottom_offset": 0,
"top_offset": 5,
"maximum": 9
},
"type": "minecraft:range"
}
},
"type": "minecraft:decorated"
},
"decorator": {
"config": {},
"type": "minecraft:square"
}
},
"type": "minecraft:decorated"
},
"decorator": {
"config": {
"count": 2
},
"type": "minecraft:count"
}
},
"type": "minecraft:decorated"
}
]
], ],
"starts": [], "starts": [],
"spawners": { "spawners": {