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:
SD 2020-09-10 08:09:52 +05:30
parent e64f2385b2
commit 73b02c278c
No known key found for this signature in database
GPG key ID: E36B57EE08544BC5
5 changed files with 22 additions and 35 deletions

View file

@ -31,11 +31,11 @@ import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
@Environment(EnvType.CLIENT)
public class ModRendering {
public static void initClient() {
OpenWorlds.registerSkyRenderer(ModDimensions.POCKET_TYPE, new CustomSkyProvider(null, null, new Vec3i(0, 0, 0)));
OpenWorlds.registerSkyRenderer(ModDimensions.LIMBO_TYPE, new LimboSkyProvider());
OpenWorlds.registerCloudRenderer(ModDimensions.LIMBO_TYPE, (minecraftClient, matrixStack, v, v1, v2, v3) -> {
OpenWorlds.registerSkyRenderer(ModDimensions.POCKET_TYPE_KEY, new CustomSkyProvider(null, null, new Vec3i(0, 0, 0)));
OpenWorlds.registerSkyRenderer(ModDimensions.LIMBO_TYPE_KEY, new LimboSkyProvider());
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"));
}

View file

@ -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> 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> POCKET_TYPE = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, new Identifier("dimdoors:personal_pockets"));
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_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 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 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_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;
@ -60,13 +60,13 @@ public final class ModDimensions {
}
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() {
ServerLifecycleEvents.SERVER_STARTED.register(server -> {
ModDimensions.LIMBO_DIMENSION_TYPE = server.getRegistryManager().getDimensionTypes().get(LIMBO_TYPE);
ModDimensions.POCKET_DIMENSION_TYPE = server.getRegistryManager().getDimensionTypes().get(POCKET_TYPE);
ModDimensions.LIMBO_TYPE = server.getRegistryManager().getDimensionTypes().get(LIMBO_TYPE_KEY);
ModDimensions.POCKET_TYPE = server.getRegistryManager().getDimensionTypes().get(POCKET_TYPE_KEY);
ModDimensions.LIMBO_DIMENSION = server.getWorld(LIMBO);
ModDimensions.PERSONAL_POCKET_DIMENSION = server.getWorld(PERSONAL);
ModDimensions.PUBLIC_POCKET_DIMENSION = server.getWorld(PUBLIC);
@ -78,7 +78,6 @@ public final class ModDimensions {
}
static {
// TODO: Remove all settings from json dimensions
StructuresConfig limboStructuresConfig = new StructuresConfig(
Optional.of(StructuresConfig.DEFAULT_STRONGHOLD),
ImmutableMap.of()
@ -91,7 +90,7 @@ public final class ModDimensions {
80, 120
),
new SlideConfig(
-1,
20,
3,
0
),

View file

@ -91,7 +91,7 @@ public class LimboChunkGenerator extends ChunkGenerator {
private final OctavePerlinNoiseSampler densityNoise;
@Nullable
private final SimplexNoiseSampler islandNoise;
private final long worldSeed;
public final long worldSeed;
private final int worldHeight;
private LimboChunkGenerator(BiomeSource biomeSource, BiomeSource biomeSource2) {
@ -364,7 +364,6 @@ public 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) {
@ -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();
int i = chunk.getPos().getStartX();
int j = chunk.getPos().getStartZ();
ChunkGeneratorSettings chunkGeneratorSettings = this.settings.get();
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;
if (bl || bl2) {
Iterator<BlockPos> var12 = BlockPos.iterate(i, 0, j, i + 15, 0, j + 15).iterator();
if (bl2) {
Iterator<BlockPos> iterator = BlockPos.iterate(i, 0, j, i + 15, 0, j + 15).iterator();
while (true) {
BlockPos blockPos;
int o;
if (!var12.hasNext()) {
if (!iterator.hasNext()) {
return;
}
blockPos = var12.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);
}
}
blockPos = iterator.next();
for (o = 4; o >= 0; --o) {
if (o <= random.nextInt(5)) {
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) {
ObjectList<StructurePiece> objectList = new ObjectArrayList<StructurePiece>(10);
ObjectList<JigsawJunction> objectList2 = new ObjectArrayList<JigsawJunction>(32);
ObjectList<StructurePiece> objectList = new ObjectArrayList<>(10);
ObjectList<JigsawJunction> objectList2 = new ObjectArrayList<>(32);
ChunkPos chunkPos = chunk.getPos();
int posX = chunkPos.x;
int posZ = chunkPos.z;
@ -434,7 +424,7 @@ public class LimboChunkGenerator extends ChunkGenerator {
return;
}
structurePiece = (StructurePiece) var6.next();
structurePiece = var6.next();
} while (!structurePiece.intersectsChunk(chunkPos, 12));
if (structurePiece instanceof PoolStructurePiece) {

View file

@ -1,7 +1,6 @@
{
"ultrawarm": false,
"natural": false,
"shrunk": false,
"ambient_light": 0.1,
"has_skylight": true,
"has_ceiling": false,

View file

@ -1,7 +1,6 @@
{
"ultrawarm": false,
"natural": false,
"shrunk": false,
"ambient_light": 0.1,
"has_skylight": true,
"has_ceiling": false,