it's something? actually generates worlds properly (slow though)

This commit is contained in:
Lemon 2018-07-26 15:28:35 +05:00
parent 7baf5f322e
commit bf6e35238e
3 changed files with 14 additions and 35 deletions

View File

@ -37,7 +37,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
public CleanroomChunkGenerator() public CleanroomChunkGenerator()
{ {
this("64,stone"); this("16,stone,32,dirt,1,grass_block");
} }
public CleanroomChunkGenerator(String id) public CleanroomChunkGenerator(String id)
@ -49,17 +49,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
int y = 0; int y = 0;
materials = new Material[128]; // Default to 128, will be resized later if required materials = new Material[128]; // Default to 128, will be resized later if required
materials[y++] = Material.BEDROCK;
if ((id.length() > 0) && (id.charAt(0) == '.'))
{
// Is the first character a '.'? If so, skip bedrock generation.
id = id.substring(1); // Skip bedrock then and remove the .
}
else
{
// Guess not, bedrock at layer0 it is then.
materials[y++] = Material.BEDROCK;
}
if (id.length() > 0) if (id.length() > 0)
{ {
@ -86,9 +76,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
log.warning("[CleanroomGenerator] Data values are no longer supported in 1.13. Defaulting to the base material for " + materialTokens[0]); log.warning("[CleanroomGenerator] Data values are no longer supported in 1.13. Defaulting to the base material for " + materialTokens[0]);
} }
log.warning(materialTokens[0]); Material mat = Material.matchMaterial(materialTokens[0].toUpperCase());
Material mat = Material.matchMaterial(materialTokens[0]);
if (mat == null) if (mat == null)
{ {
log.warning("[CleanroomGenerator] Invalid Block ID '" + materialTokens[0] + "'. Defaulting to stone. (Integer IDs were removed in 1.13)"); log.warning("[CleanroomGenerator] Invalid Block ID '" + materialTokens[0] + "'. Defaulting to stone. (Integer IDs were removed in 1.13)");
@ -154,9 +142,15 @@ public class CleanroomChunkGenerator extends ChunkGenerator
ChunkData result = createChunkData(world); ChunkData result = createChunkData(world);
for (int i = 0; i < materials.length; i++) for (int y = 0; y < materials.length; y++)
{ {
result.setRegion(0, i, 0, 15, i, 15, materials[i]); for (int X = 0; X < 16; X++)
{
for (int Z = 0; Z < 16; Z++)
{
result.setBlock(X, y, Z, materials[y]);
}
}
} }
return result; return result;

View File

@ -1,30 +1,15 @@
package me.totalfreedom.totalfreedommod.world; package me.totalfreedom.totalfreedommod.world;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog; import org.bukkit.*;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent;
public final class MasterBuilderWorld extends CustomWorld public final class MasterBuilderWorld extends CustomWorld
{ {
private static final String GENERATION_PARAMETERS = ConfigEntry.FLATLANDS_GENERATE_PARAMS.getString();; private static final String GENERATION_PARAMETERS = ConfigEntry.FLATLANDS_GENERATE_PARAMS.getString();
// //
private WorldWeather weather = WorldWeather.OFF; private WorldWeather weather = WorldWeather.OFF;
private WorldTime time = WorldTime.INHERIT; private WorldTime time = WorldTime.INHERIT;

View File

@ -231,7 +231,7 @@ flatlands:
generate: true generate: true
# Flatlands generation parameters - Uses CleanroomGenerator syntax - http://dev.bukkit.org/server-mods/cleanroomgenerator/ # Flatlands generation parameters - Uses CleanroomGenerator syntax - http://dev.bukkit.org/server-mods/cleanroomgenerator/
generate_params: 16,stone,32,dirt,1,grass generate_params: 16,stone,32,dirt,1,grass_block
# Admin-Only Mode # Admin-Only Mode
admin_only_mode: false admin_only_mode: false