Fix nether lava issues.

This commit is contained in:
Fernando Pettinelli 2020-12-21 16:49:11 -03:00
parent af918a7c9f
commit 96db34a90f
2 changed files with 23 additions and 25 deletions

View File

@ -47,9 +47,9 @@ public class WorldManager {
String netherWorldGeneratorName = configLoad.getString("Island.World.End.CustomWorldGenerator");
String endWorldGeneratorName = configLoad.getString("Island.World.End.CustomWorldGenerator");
normalWorldWorldGenerator = getWorldGenerator(normalWorldName, normalWorldGeneratorName);
netherWorldWorldGenerator = getWorldGenerator(netherWorldName, netherWorldGeneratorName);
endWorldWorldGenerator = getWorldGenerator(endWorldName, endWorldGeneratorName);
normalWorldWorldGenerator = getWorldGenerator(normalWorldName, normalWorldGeneratorName, IslandWorld.Normal);
netherWorldWorldGenerator = getWorldGenerator(netherWorldName, netherWorldGeneratorName, IslandWorld.Nether);
endWorldWorldGenerator = getWorldGenerator(endWorldName, endWorldGeneratorName, IslandWorld.End);
normalWorld = Bukkit.getServer().getWorld(normalWorldName);
netherWorld = Bukkit.getServer().getWorld(netherWorldName);
@ -138,9 +138,9 @@ public class WorldManager {
return location;
}
private ChunkGenerator getWorldGenerator(String mapName, String worldGeneratorName) {
private ChunkGenerator getWorldGenerator(String mapName, String worldGeneratorName, IslandWorld islandWorld) {
if (worldGeneratorName == null || worldGeneratorName == "default" || worldGeneratorName.length() == 0) {
return new VoidGenerator();
return new VoidGenerator(islandWorld);
}
ChunkGenerator customWorldGenerator = WorldCreator.getGeneratorForName(mapName, worldGeneratorName, null);
@ -149,7 +149,7 @@ public class WorldManager {
return customWorldGenerator;
}
return new VoidGenerator();
return new VoidGenerator(islandWorld);
}
public ChunkGenerator getWorldGeneratorForMapName(String mapName) {
@ -159,6 +159,6 @@ public class WorldManager {
if (endWorld != null && endWorld.getName().equals(mapName)) return endWorldWorldGenerator;
return new VoidGenerator();
return new VoidGenerator(IslandWorld.Normal);
}
}

View File

@ -21,6 +21,11 @@ import java.util.Random;
public class VoidGenerator extends ChunkGenerator {
private final IslandWorld islandWorld;
public VoidGenerator(IslandWorld islandWorld) {
this.islandWorld = islandWorld;
}
@Override
public @Nonnull ChunkData generateChunkData(@Nonnull World world, @Nonnull Random random, int chunkX, int chunkZ, @Nonnull BiomeGrid biomeGrid) {
final ChunkData chunkData = createChunkData(world);
@ -28,7 +33,7 @@ public class VoidGenerator extends ChunkGenerator {
final SkyBlock plugin = SkyBlock.getInstance();
final Configuration configLoad = plugin.getConfiguration();
final ConfigurationSection worldSection = configLoad.getConfigurationSection("Island.World");
Biome biome;
switch (world.getEnvironment()) {
@ -50,26 +55,19 @@ public class VoidGenerator extends ChunkGenerator {
} else {
setChunkBiome2D(biome, biomeGrid);
}
for (IslandWorld worldList : IslandWorld.values()) {
if (world.getEnvironment() == World.Environment.NETHER
|| world.getEnvironment() == World.Environment.NORMAL
|| world.getEnvironment() == World.Environment.THE_END) {
ConfigurationSection section = worldSection.getConfigurationSection(worldList.name());
ConfigurationSection section = worldSection.getConfigurationSection(islandWorld.name());
if (section.getBoolean("Liquid.Enable")) {
if (section.getBoolean("Liquid.Lava")) {
setBlock(chunkData, CompatibleMaterial.LAVA.getBlockMaterial(), section.getInt("Liquid.Height"));
} else {
setBlock(chunkData, CompatibleMaterial.WATER.getBlockMaterial(), section.getInt("Liquid.Height"));
}
}
break;
if (section.getBoolean("Liquid.Enable")) {
if (section.getBoolean("Liquid.Lava")) {
setBlock(chunkData, CompatibleMaterial.LAVA.getBlockMaterial(), section.getInt("Liquid.Height"));
} else {
setBlock(chunkData, CompatibleMaterial.WATER.getBlockMaterial(), section.getInt("Liquid.Height"));
}
}
return chunkData;
}
@ -96,7 +94,7 @@ public class VoidGenerator extends ChunkGenerator {
}
}
}
// Do not use - Too laggy
private void setChunkBiome3D(Biome biome, BiomeGrid grid, World world) {
for(int x = 0; x < 16; x++){
@ -107,7 +105,7 @@ public class VoidGenerator extends ChunkGenerator {
}
}
}
private void setChunkBiome2D(Biome biome, BiomeGrid grid) {
for(int x = 0; x < 16; x++){
for(int z = 0; z < 16; z++){