Skip to content

Commit

Permalink
Testing the Schematic World saving
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Dec 23, 2024
1 parent ab36d1f commit f7d9b9d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
6 changes: 5 additions & 1 deletion src/main/java/fi/dy/masa/litematica/util/WorldUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,11 @@ private static boolean writeVanillaStructureToFile(StructureTemplate template, F

public static boolean isClientChunkLoaded(ClientWorld world, int chunkX, int chunkZ)
{
return ((ClientChunkManager) world.getChunkManager()).getChunk(chunkX, chunkZ, ChunkStatus.FULL, false) != null;
boolean test = ((ClientChunkManager) world.getChunkManager()).getChunk(chunkX, chunkZ, ChunkStatus.FULL, false) != null;

//System.out.printf("isClientChunkLoaded(): World: [%s] / ChunkPos[%d, %d] --> [%s]\n", world.toString(), chunkX, chunkZ, test);

return test;
}

public static void loadChunksSchematicWorld(WorldSchematic world, BlockPos origin, Vec3i areaSize)
Expand Down
28 changes: 6 additions & 22 deletions src/main/java/fi/dy/masa/litematica/world/WorldSchematic.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import net.minecraft.world.MutableWorldProperties;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.chunk.WorldChunk;
Expand Down Expand Up @@ -94,6 +93,12 @@ public WorldSchematic(MutableWorldProperties properties,
this.tickManager = new TickManager();
}

@Override
public String toString()
{
return "SchematicWorld["+REGISTRY_KEY.getValue().toString()+"]";
}

private void setDimension(DynamicRegistryManager registryManager)
{
RegistryEntryLookup<DimensionType> entryLookup = registryManager.getOrThrow(RegistryKeys.DIMENSION_TYPE);
Expand All @@ -102,17 +107,14 @@ private void setDimension(DynamicRegistryManager registryManager)

if (this.dimensionType.equals(nether))
{
//this.biome = this.getWastes(registryManager);
this.biome = WorldUtils.getWastes(registryManager);
}
else if (this.dimensionType.equals(end))
{
//this.biome = this.getTheEnd(registryManager);
this.biome = WorldUtils.getTheEnd(registryManager);
}
else
{
//this.biome = this.getPlains(registryManager);
this.biome = WorldUtils.getPlains(registryManager);
}

Expand Down Expand Up @@ -613,24 +615,6 @@ public FeatureSet getEnabledFeatures()
}
}

private RegistryEntry<Biome> getPlains(DynamicRegistryManager registryManager)
{
RegistryEntryLookup<Biome> biomeLookup = registryManager.getOrThrow(RegistryKeys.BIOME);
return biomeLookup.getOrThrow(BiomeKeys.PLAINS);
}

private RegistryEntry<Biome> getWastes(DynamicRegistryManager registryManager)
{
RegistryEntryLookup<Biome> biomeLookup = registryManager.getOrThrow(RegistryKeys.BIOME);
return biomeLookup.getOrThrow(BiomeKeys.NETHER_WASTES);
}

private RegistryEntry<Biome> getTheEnd(DynamicRegistryManager registryManager)
{
RegistryEntryLookup<Biome> biomeLookup = registryManager.getOrThrow(RegistryKeys.BIOME);
return biomeLookup.getOrThrow(BiomeKeys.THE_END);
}

@Override
public String asString()
{
Expand Down

0 comments on commit f7d9b9d

Please sign in to comment.