Refactors
Changes to be committed: modified: src/main/java/org/dimdev/dimdoors/client/ModRendering.java modified: src/main/java/org/dimdev/dimdoors/world/ModDimensions.java modified: src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java modified: src/main/resources/data/dimdoors/dimension_type/limbo.json modified: src/main/resources/data/dimdoors/dimension_type/pocket.json
This commit is contained in:
parent
e64f2385b2
commit
73b02c278c
5 changed files with 22 additions and 35 deletions
|
@ -31,11 +31,11 @@ import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public class ModRendering {
|
public class ModRendering {
|
||||||
public static void initClient() {
|
public static void initClient() {
|
||||||
OpenWorlds.registerSkyRenderer(ModDimensions.POCKET_TYPE, new CustomSkyProvider(null, null, new Vec3i(0, 0, 0)));
|
OpenWorlds.registerSkyRenderer(ModDimensions.POCKET_TYPE_KEY, new CustomSkyProvider(null, null, new Vec3i(0, 0, 0)));
|
||||||
OpenWorlds.registerSkyRenderer(ModDimensions.LIMBO_TYPE, new LimboSkyProvider());
|
OpenWorlds.registerSkyRenderer(ModDimensions.LIMBO_TYPE_KEY, new LimboSkyProvider());
|
||||||
OpenWorlds.registerCloudRenderer(ModDimensions.LIMBO_TYPE, (minecraftClient, matrixStack, v, v1, v2, v3) -> {
|
OpenWorlds.registerCloudRenderer(ModDimensions.LIMBO_TYPE_KEY, (minecraftClient, matrixStack, v, v1, v2, v3) -> {
|
||||||
});
|
});
|
||||||
OpenWorlds.registerSkyProperty(ModDimensions.LIMBO_TYPE, LimboSkyProperties.INSTANCE);
|
OpenWorlds.registerSkyProperty(ModDimensions.LIMBO_TYPE_KEY, LimboSkyProperties.INSTANCE);
|
||||||
|
|
||||||
setupFluidRendering(ModFluids.ETERNAL_FLUID, ModFluids.FLOWING_ETERNAL_FLUID, new Identifier("dimdoors:eternal_fluid"));
|
setupFluidRendering(ModFluids.ETERNAL_FLUID, ModFluids.FLOWING_ETERNAL_FLUID, new Identifier("dimdoors:eternal_fluid"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,11 @@ 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 DimensionType LIMBO_DIMENSION_TYPE = DimensionTypeAccessor.invokeInit(OptionalLong.of(6000), false, false, false, false, 4.0, false, false, true, false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), DimensionType.THE_END_ID, 0.1F);
|
public static DimensionType LIMBO_TYPE = DimensionTypeAccessor.invokeInit(OptionalLong.of(6000), false, false, false, false, 4.0, false, false, true, false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), DimensionType.THE_END_ID, 0.1F);
|
||||||
public static DimensionType POCKET_DIMENSION_TYPE = DimensionTypeAccessor.invokeInit(OptionalLong.empty(), true, false, false, false, 4.0, false, false, true, false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), DimensionType.THE_END_ID, 0.1F);
|
public static DimensionType POCKET_TYPE = DimensionTypeAccessor.invokeInit(OptionalLong.empty(), true, false, false, false, 4.0, false, false, true, false, 256, BlockTags.INFINIBURN_OVERWORLD.getId(), DimensionType.THE_END_ID, 0.1F);
|
||||||
|
|
||||||
public static final ChunkGeneratorSettings LIMBO_CHUNK_GENERATOR_SETTINGS;
|
public static final ChunkGeneratorSettings LIMBO_CHUNK_GENERATOR_SETTINGS;
|
||||||
|
|
||||||
|
@ -60,13 +60,13 @@ public final class ModDimensions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLimboDimension(World world) {
|
public static boolean isLimboDimension(World world) {
|
||||||
return world.getRegistryKey() == LIMBO || world.getDimension() == LIMBO_DIMENSION_TYPE || world == LIMBO_DIMENSION;
|
return world.getRegistryKey() == LIMBO || world.getDimension() == LIMBO_TYPE || world == LIMBO_DIMENSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
ServerLifecycleEvents.SERVER_STARTED.register(server -> {
|
ServerLifecycleEvents.SERVER_STARTED.register(server -> {
|
||||||
ModDimensions.LIMBO_DIMENSION_TYPE = server.getRegistryManager().getDimensionTypes().get(LIMBO_TYPE);
|
ModDimensions.LIMBO_TYPE = server.getRegistryManager().getDimensionTypes().get(LIMBO_TYPE_KEY);
|
||||||
ModDimensions.POCKET_DIMENSION_TYPE = server.getRegistryManager().getDimensionTypes().get(POCKET_TYPE);
|
ModDimensions.POCKET_TYPE = server.getRegistryManager().getDimensionTypes().get(POCKET_TYPE_KEY);
|
||||||
ModDimensions.LIMBO_DIMENSION = server.getWorld(LIMBO);
|
ModDimensions.LIMBO_DIMENSION = server.getWorld(LIMBO);
|
||||||
ModDimensions.PERSONAL_POCKET_DIMENSION = server.getWorld(PERSONAL);
|
ModDimensions.PERSONAL_POCKET_DIMENSION = server.getWorld(PERSONAL);
|
||||||
ModDimensions.PUBLIC_POCKET_DIMENSION = server.getWorld(PUBLIC);
|
ModDimensions.PUBLIC_POCKET_DIMENSION = server.getWorld(PUBLIC);
|
||||||
|
@ -78,7 +78,6 @@ public final class ModDimensions {
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// TODO: Remove all settings from json dimensions
|
|
||||||
StructuresConfig limboStructuresConfig = new StructuresConfig(
|
StructuresConfig limboStructuresConfig = new StructuresConfig(
|
||||||
Optional.of(StructuresConfig.DEFAULT_STRONGHOLD),
|
Optional.of(StructuresConfig.DEFAULT_STRONGHOLD),
|
||||||
ImmutableMap.of()
|
ImmutableMap.of()
|
||||||
|
@ -91,7 +90,7 @@ public final class ModDimensions {
|
||||||
80, 120
|
80, 120
|
||||||
),
|
),
|
||||||
new SlideConfig(
|
new SlideConfig(
|
||||||
-1,
|
20,
|
||||||
3,
|
3,
|
||||||
0
|
0
|
||||||
),
|
),
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class LimboChunkGenerator extends ChunkGenerator {
|
||||||
private final OctavePerlinNoiseSampler densityNoise;
|
private final OctavePerlinNoiseSampler densityNoise;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final SimplexNoiseSampler islandNoise;
|
private final SimplexNoiseSampler islandNoise;
|
||||||
private final long worldSeed;
|
public final long worldSeed;
|
||||||
private final int worldHeight;
|
private final int worldHeight;
|
||||||
|
|
||||||
private LimboChunkGenerator(BiomeSource biomeSource, BiomeSource biomeSource2) {
|
private LimboChunkGenerator(BiomeSource biomeSource, BiomeSource biomeSource2) {
|
||||||
|
@ -364,7 +364,6 @@ public class LimboChunkGenerator extends ChunkGenerator {
|
||||||
ChunkPos chunkPos2 = chunk.getPos();
|
ChunkPos chunkPos2 = chunk.getPos();
|
||||||
int k = chunkPos2.getStartX();
|
int k = chunkPos2.getStartX();
|
||||||
int l = chunkPos2.getStartZ();
|
int l = chunkPos2.getStartZ();
|
||||||
double d = 0.0625D;
|
|
||||||
BlockPos.Mutable mutable = new BlockPos.Mutable();
|
BlockPos.Mutable mutable = new BlockPos.Mutable();
|
||||||
|
|
||||||
for (int m = 0; m < 16; ++m) {
|
for (int m = 0; m < 16; ++m) {
|
||||||
|
@ -377,35 +376,26 @@ public class LimboChunkGenerator extends ChunkGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.buildBedrock(chunk, chunkRandom);
|
this.buildFluid(chunk, chunkRandom);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildBedrock(Chunk chunk, Random random) {
|
private void buildFluid(Chunk chunk, Random random) {
|
||||||
BlockPos.Mutable mutable = new BlockPos.Mutable();
|
BlockPos.Mutable mutable = new BlockPos.Mutable();
|
||||||
int i = chunk.getPos().getStartX();
|
int i = chunk.getPos().getStartX();
|
||||||
int j = chunk.getPos().getStartZ();
|
int j = chunk.getPos().getStartZ();
|
||||||
ChunkGeneratorSettings chunkGeneratorSettings = this.settings.get();
|
ChunkGeneratorSettings chunkGeneratorSettings = this.settings.get();
|
||||||
int k = chunkGeneratorSettings.getBedrockFloorY();
|
int k = chunkGeneratorSettings.getBedrockFloorY();
|
||||||
int l = this.worldHeight - 1 - chunkGeneratorSettings.getBedrockCeilingY();
|
|
||||||
boolean bl = l + 4 >= 0 && l < this.worldHeight;
|
|
||||||
boolean bl2 = k + 4 >= 0 && k < this.worldHeight;
|
boolean bl2 = k + 4 >= 0 && k < this.worldHeight;
|
||||||
if (bl || bl2) {
|
if (bl2) {
|
||||||
Iterator<BlockPos> var12 = BlockPos.iterate(i, 0, j, i + 15, 0, j + 15).iterator();
|
Iterator<BlockPos> iterator = BlockPos.iterate(i, 0, j, i + 15, 0, j + 15).iterator();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
BlockPos blockPos;
|
BlockPos blockPos;
|
||||||
int o;
|
int o;
|
||||||
if (!var12.hasNext()) {
|
if (!iterator.hasNext()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockPos = var12.next();
|
blockPos = iterator.next();
|
||||||
for (o = 0; o < 5; ++o) {
|
|
||||||
if (o <= random.nextInt(5)) {
|
|
||||||
chunk.setBlockState(mutable.set(blockPos.getX(), l - o, blockPos.getZ()), ModBlocks.ETERNAL_FLUID.getDefaultState(), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (o = 4; o >= 0; --o) {
|
for (o = 4; o >= 0; --o) {
|
||||||
if (o <= random.nextInt(5)) {
|
if (o <= random.nextInt(5)) {
|
||||||
chunk.setBlockState(mutable.set(blockPos.getX(), k + o, blockPos.getZ()), ModBlocks.ETERNAL_FLUID.getDefaultState(), false);
|
chunk.setBlockState(mutable.set(blockPos.getX(), k + o, blockPos.getZ()), ModBlocks.ETERNAL_FLUID.getDefaultState(), false);
|
||||||
|
@ -416,8 +406,8 @@ public class LimboChunkGenerator extends ChunkGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void populateNoise(WorldAccess world, StructureAccessor accessor, Chunk chunk) {
|
public void populateNoise(WorldAccess world, StructureAccessor accessor, Chunk chunk) {
|
||||||
ObjectList<StructurePiece> objectList = new ObjectArrayList<StructurePiece>(10);
|
ObjectList<StructurePiece> objectList = new ObjectArrayList<>(10);
|
||||||
ObjectList<JigsawJunction> objectList2 = new ObjectArrayList<JigsawJunction>(32);
|
ObjectList<JigsawJunction> objectList2 = new ObjectArrayList<>(32);
|
||||||
ChunkPos chunkPos = chunk.getPos();
|
ChunkPos chunkPos = chunk.getPos();
|
||||||
int posX = chunkPos.x;
|
int posX = chunkPos.x;
|
||||||
int posZ = chunkPos.z;
|
int posZ = chunkPos.z;
|
||||||
|
@ -434,7 +424,7 @@ public class LimboChunkGenerator extends ChunkGenerator {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
structurePiece = (StructurePiece) var6.next();
|
structurePiece = var6.next();
|
||||||
} while (!structurePiece.intersectsChunk(chunkPos, 12));
|
} while (!structurePiece.intersectsChunk(chunkPos, 12));
|
||||||
|
|
||||||
if (structurePiece instanceof PoolStructurePiece) {
|
if (structurePiece instanceof PoolStructurePiece) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"ultrawarm": false,
|
"ultrawarm": false,
|
||||||
"natural": false,
|
"natural": false,
|
||||||
"shrunk": false,
|
|
||||||
"ambient_light": 0.1,
|
"ambient_light": 0.1,
|
||||||
"has_skylight": true,
|
"has_skylight": true,
|
||||||
"has_ceiling": false,
|
"has_ceiling": false,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"ultrawarm": false,
|
"ultrawarm": false,
|
||||||
"natural": false,
|
"natural": false,
|
||||||
"shrunk": false,
|
|
||||||
"ambient_light": 0.1,
|
"ambient_light": 0.1,
|
||||||
"has_skylight": true,
|
"has_skylight": true,
|
||||||
"has_ceiling": false,
|
"has_ceiling": false,
|
||||||
|
|
Loading…
Reference in a new issue