More changes...

This commit is contained in:
boy0001 2014-10-08 20:02:08 +11:00
parent 0d55e1a2dc
commit 74a6d2d28a
6 changed files with 240 additions and 224 deletions

View File

@ -1,5 +1,8 @@
package com.intellectualcrafters.plot; package com.intellectualcrafters.plot;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
public class Configuration { public class Configuration {
@ -93,6 +96,11 @@ public class Configuration {
public Object parseString(String string) { public Object parseString(String string) {
return Biome.valueOf(string.toUpperCase()); return Biome.valueOf(string.toUpperCase());
} }
@Override
public Object parseObject(Object object) {
return ((Biome) object).toString();
}
}; };
public static final SettingValue BLOCK = new SettingValue("BLOCK") { public static final SettingValue BLOCK = new SettingValue("BLOCK") {
@ -121,6 +129,11 @@ public class Configuration {
return new PlotBlock(Short.parseShort(string), (byte) 0); return new PlotBlock(Short.parseShort(string), (byte) 0);
} }
} }
@Override
public Object parseObject(Object object) {
return ((PlotBlock) object).id+":"+((PlotBlock) object).data;
}
}; };
public static final SettingValue BLOCKLIST = new SettingValue("BLOCKLIST") { public static final SettingValue BLOCKLIST = new SettingValue("BLOCKLIST") {
@ -156,6 +169,14 @@ public class Configuration {
} }
return values; return values;
} }
@Override
public Object parseObject(Object object) {
List<String> list = new ArrayList<String>();
for (PlotBlock block:(PlotBlock[]) object) {
list.add((block.id+":"+(block.data)));
}
return list;
}
}; };
public static abstract class SettingValue { public static abstract class SettingValue {
@ -168,6 +189,10 @@ public class Configuration {
public String getType() { public String getType() {
return this.type; return this.type;
} }
public Object parseObject(Object object) {
return object;
}
public abstract Object parseString(String string); public abstract Object parseString(String string);

View File

@ -1,16 +1,12 @@
package com.intellectualcrafters.plot; package com.intellectualcrafters.plot;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
public abstract class PlotGenerator { public abstract class PlotGenerator extends ChunkGenerator {
public PlotGenerator(String world){ public abstract PlotWorld getPlotWorld();
}
public abstract PlotManager getPlotManager();
public abstract PlotWorld getPlotWorld(String world);
public abstract ChunkGenerator getChunkGenerator(PlotWorld plotworld, String world);
public abstract PlotManager getPlotManager(PlotWorld plotworld);
} }

View File

@ -1,40 +0,0 @@
package com.intellectualcrafters.plot.generator;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import com.intellectualcrafters.plot.PlotGenerator;
import com.intellectualcrafters.plot.PlotManager;
import com.intellectualcrafters.plot.PlotWorld;
public class DefaultPlotGenerator extends PlotGenerator {
private final PlotWorld plotworld;
private final ChunkGenerator generator;
private static PlotManager manager = null;
public DefaultPlotGenerator(String worldname) {
super(worldname);
this.plotworld = new DefaultPlotWorld(worldname);
this.generator = new WorldGenerator(plotworld, worldname);
if (manager==null) {
DefaultPlotGenerator.manager = new DefaultPlotManager();
}
}
@Override
public PlotWorld getPlotWorld(String worldname) {
return this.plotworld;
}
@Override
public ChunkGenerator getChunkGenerator(PlotWorld plotworld, String worldname) {
return this.generator;
}
@Override
public PlotManager getPlotManager(PlotWorld plotworld) {
return manager;
}
}

View File

@ -19,6 +19,8 @@ public class DefaultPlotWorld extends PlotWorld {
public boolean AUTO_MERGE; public boolean AUTO_MERGE;
public static boolean AUTO_MERGE_DEFAULT = false; public static boolean AUTO_MERGE_DEFAULT = false;
public boolean MOB_SPAWNING;
public static boolean MOB_SPAWNING_DEFAULT = false;
/** /**
* Road Height * Road Height
*/ */
@ -152,7 +154,7 @@ public class DefaultPlotWorld extends PlotWorld {
*/ */
public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false; public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
public boolean SCHEMATIC_CLAIM_SPECIFY = false; public boolean SCHEMATIC_CLAIM_SPECIFY = false;
public List<String> SCHEMATICS = new ArrayList<>(); public List<String> SCHEMATICS = new ArrayList<String>();
/** /**
* schematic file * schematic file
@ -189,6 +191,7 @@ public class DefaultPlotWorld extends PlotWorld {
// TODO return a set of configuration nodes (used for setup command) // TODO return a set of configuration nodes (used for setup command)
return return
new ConfigurationNode[] { new ConfigurationNode[] {
new ConfigurationNode("natural_mob_spawning", MOB_SPAWNING, "Enable mob spawning", Configuration.BOOLEAN, false),
new ConfigurationNode("plot.auto_merge", AUTO_MERGE, "Enable Auto plot merging", Configuration.BOOLEAN, false), new ConfigurationNode("plot.auto_merge", AUTO_MERGE, "Enable Auto plot merging", Configuration.BOOLEAN, false),
new ConfigurationNode("plot.height", PLOT_HEIGHT, "Plot height", Configuration.INTEGER, true), new ConfigurationNode("plot.height", PLOT_HEIGHT, "Plot height", Configuration.INTEGER, true),
new ConfigurationNode("plot.width", PLOT_WIDTH, "Plot width", Configuration.INTEGER, true), new ConfigurationNode("plot.width", PLOT_WIDTH, "Plot width", Configuration.INTEGER, true),
@ -216,6 +219,7 @@ public class DefaultPlotWorld extends PlotWorld {
@Override @Override
public void loadConfiguration(ConfigurationSection config) { public void loadConfiguration(ConfigurationSection config) {
this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning");
this.AUTO_MERGE = config.getBoolean("plot.auto_merge"); this.AUTO_MERGE = config.getBoolean("plot.auto_merge");
this.PLOT_HEIGHT = config.getInt("plot.height"); this.PLOT_HEIGHT = config.getInt("plot.height");
this.PLOT_WIDTH = config.getInt("plot.width"); this.PLOT_WIDTH = config.getInt("plot.width");

View File

@ -11,6 +11,8 @@ import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
import com.intellectualcrafters.plot.PlotBlock; import com.intellectualcrafters.plot.PlotBlock;
import com.intellectualcrafters.plot.PlotGenerator;
import com.intellectualcrafters.plot.PlotManager;
import com.intellectualcrafters.plot.PlotWorld; import com.intellectualcrafters.plot.PlotWorld;
/** /**
@ -19,9 +21,61 @@ import com.intellectualcrafters.plot.PlotWorld;
* @author Citymonstret * @author Citymonstret
* *
*/ */
public class WorldGenerator extends ChunkGenerator { public class WorldGenerator extends PlotGenerator {
private long state; /*
* result object is returned for each generated chunk, do stuff to it
*/
short[][] result;
/*
* plotworld object
*/
DefaultPlotWorld plotworld;
/*
* Set to static to re-use the same managet for all Default World Generators
*/
private static PlotManager manager = null;
/*
* Some generator specific variables (implementation dependent)
*/
int plotsize;
int pathsize;
PlotBlock wall;
PlotBlock wallfilling;
PlotBlock floor1;
PlotBlock floor2;
int size;
Biome biome;
int roadheight;
int wallheight;
int plotheight;
PlotBlock[] plotfloors;
PlotBlock[] filling;
/*
* Return the plot manager for this type of generator, or create one
*
*/
@Override
public PlotManager getPlotManager() {
if (manager==null) {
manager = new DefaultPlotManager();
}
return null;
}
// return the PlotWorld
@Override
public PlotWorld getPlotWorld() {
return this.plotworld;
}
/*
* Faster sudo-random number generator than java.util.random
*/
private long state;
public final long nextLong() { public final long nextLong() {
long a = this.state; long a = this.state;
this.state = xorShift64(a); this.state = xorShift64(a);
@ -39,69 +93,11 @@ public class WorldGenerator extends ChunkGenerator {
long r = ((nextLong() >>> 32) * n) >> 32; long r = ((nextLong() >>> 32) * n) >> 32;
return (int) r; return (int) r;
} }
DefaultPlotWorld plotworld; /*
short[][] result; * Cuboid based plot generation is quick, as it requires no calculations inside the loop
int plotsize; * - You don't have to use this this method, but you may find it useful.
int pathsize; */
PlotBlock wall;
PlotBlock wallfilling;
PlotBlock floor1;
PlotBlock floor2;
int size;
Biome biome;
int roadheight;
int wallheight;
int plotheight;
PlotBlock[] plotfloors;
PlotBlock[] filling;
public Short getBlock(String block) {
if (block.contains(":")) {
String[] split = block.split(":");
return Short.parseShort(split[0]);
}
return Short.parseShort(block);
}
public WorldGenerator(PlotWorld pw, String world) {
//
this.plotworld = (DefaultPlotWorld) pw;
// save configuration
plotsize = plotworld.PLOT_WIDTH;
pathsize = plotworld.ROAD_WIDTH;
floor1 = plotworld.ROAD_BLOCK;
floor2 = plotworld.ROAD_STRIPES;
wallfilling = plotworld.WALL_FILLING;
size = pathsize + plotsize;
wall = plotworld.WALL_BLOCK;
plotfloors = plotworld.TOP_BLOCK;
filling = plotworld.MAIN_BLOCK;
wallheight = plotworld.WALL_HEIGHT;
roadheight = plotworld.ROAD_HEIGHT;
plotheight = plotworld.PLOT_HEIGHT;
biome = plotworld.PLOT_BIOME;
}
@Override
public List<BlockPopulator> getDefaultPopulators(World world) {
world.setSpawnFlags(false, false);
return Arrays.asList((BlockPopulator) new XPopulator(plotworld));
}
@Override
public Location getFixedSpawnLocation(World world, Random random) {
return new Location(world, 0, plotworld.ROAD_HEIGHT + 2, 0);
}
public void setCuboidRegion(int x1, int x2, int y1, int y2, int z1, int z2, PlotBlock block) { public void setCuboidRegion(int x1, int x2, int y1, int y2, int z1, int z2, PlotBlock block) {
for (int x = x1; x < x2; x++) { for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) { for (int z = z1; z < z2; z++) {
@ -125,9 +121,72 @@ public class WorldGenerator extends ChunkGenerator {
} }
} }
} }
}
/*
* Standard setblock method for world generation
*/
private void setBlock(short[][] result, int x, int y, int z, short blkid) {
if (result[y >> 4] == null) {
result[y >> 4] = new short[4096];
}
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid;
}
/*
* Initialize variables, and create plotworld object used in calculations
*/
public WorldGenerator(String world) {
this.plotworld = new DefaultPlotWorld(world);
plotsize = plotworld.PLOT_WIDTH;
pathsize = plotworld.ROAD_WIDTH;
floor1 = plotworld.ROAD_BLOCK;
floor2 = plotworld.ROAD_STRIPES;
wallfilling = plotworld.WALL_FILLING;
size = pathsize + plotsize;
wall = plotworld.WALL_BLOCK;
plotfloors = plotworld.TOP_BLOCK;
filling = plotworld.MAIN_BLOCK;
wallheight = plotworld.WALL_HEIGHT;
roadheight = plotworld.ROAD_HEIGHT;
plotheight = plotworld.PLOT_HEIGHT;
biome = plotworld.PLOT_BIOME;
} }
/*
* Return the block populator
*/
@Override
public List<BlockPopulator> getDefaultPopulators(World world) {
// disabling spawning for this world
if (!this.plotworld.MOB_SPAWNING) {
world.setSpawnFlags(false, false);
world.setAmbientSpawnLimit(0);
world.setAnimalSpawnLimit(0);
world.setMonsterSpawnLimit(0);
world.setWaterAnimalSpawnLimit(0);
}
// You can have as many populators as you would like, e.g. tree populator, ore populator
return Arrays.asList((BlockPopulator) new XPopulator(plotworld));
}
/*
* Return the default spawn location for this world
*/
@Override
public Location getFixedSpawnLocation(World world, Random random) {
return new Location(world, 0, plotworld.ROAD_HEIGHT + 2, 0);
}
/*
* This part is a fucking mess.
* - Refer to a proper tutorial if you would like to learn how to make a world generator
*/
@Override @Override
public short[][] generateExtBlockSections(World world, Random random, int cx, int cz, BiomeGrid biomes) { public short[][] generateExtBlockSections(World world, Random random, int cx, int cz, BiomeGrid biomes) {
@ -456,13 +515,8 @@ public class WorldGenerator extends ChunkGenerator {
setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, this.wallheight + 1, this.wallheight + 2, start, 16, this.wall); setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, this.wallheight + 1, this.wallheight + 2, start, 16, this.wall);
} }
} }
// Return the chunk
return this.result; return this.result;
} }
private void setBlock(short[][] result, int x, int y, int z, short blkid) {
if (result[y >> 4] == null) {
result[y >> 4] = new short[4096];
}
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid;
}
} }

View File

@ -4,8 +4,10 @@ import java.util.Random;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import com.intellectualcrafters.plot.PlotBlock;
import com.intellectualcrafters.plot.PlotWorld; import com.intellectualcrafters.plot.PlotWorld;
/** /**
@ -36,29 +38,29 @@ public class XPopulator extends BlockPopulator {
return (int) result; return (int) result;
} }
public void setCuboidRegion(int x1, int x2, int y1, int y2, int z1, int z2, short id, byte data, World w) { public void setCuboidRegion(int x1, int x2, int y1, int y2, int z1, int z2, PlotBlock block, World w) {
if (data == 0) { if (block.data == 0) {
return; return;
} }
for (int x = x1; x < x2; x++) { for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) { for (int z = z1; z < z2; z++) {
for (int y = y1; y < y2; y++) { for (int y = y1; y < y2; y++) {
setBlock(w, x, y, z, id, data); setBlock(w, x, y, z, block.id, block.data);
} }
} }
} }
} }
private void setCuboidRegion(int x1, int x2, int y1, int y2, int z1, int z2, short[] id, short[] v, World w) { private void setCuboidRegion(int x1, int x2, int y1, int y2, int z1, int z2, PlotBlock[] blocks, World w) {
if (id.length == 1) { if (blocks.length == 1) {
setCuboidRegion(x1, x2, y1, y2, z1, z2, id[0], (byte) v[0], w); setCuboidRegion(x1, x2, y1, y2, z1, z2, blocks[0], w);
} else { } else {
for (int x = x1; x < x2; x++) { for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) { for (int z = z1; z < z2; z++) {
for (int y = y1; y < y2; y++) { for (int y = y1; y < y2; y++) {
int i = random(id.length); int i = random(blocks.length);
if (v[i] != 0) { if (blocks[i].data != 0) {
setBlock(w, x, y, z, id[i], (byte) v[i]); setBlock(w, x, y, z, blocks[i].id, blocks[i].data);
} }
} }
} }
@ -75,10 +77,20 @@ public class XPopulator extends BlockPopulator {
return new short[] { Short.parseShort(block), 0 }; return new short[] { Short.parseShort(block), 0 };
} }
private int plotsize, pathsize, plotheight, wallheight, roadheight, size; int plotsize;
private byte w_v, f1_v, wf_v, f2_v; int pathsize;
private short w_id, f1_id, wf_id, f2_id; PlotBlock wall;
private short[] p_id, p_v, f_id, f_v; PlotBlock wallfilling;
PlotBlock floor1;
PlotBlock floor2;
int size;
Biome biome;
int roadheight;
int wallheight;
int plotheight;
PlotBlock[] plotfloors;
PlotBlock[] filling;
private double pathWidthLower; private double pathWidthLower;
private DefaultPlotWorld plotworld; private DefaultPlotWorld plotworld;
@ -99,46 +111,11 @@ public class XPopulator extends BlockPopulator {
plotfloors = plotworld.TOP_BLOCK; plotfloors = plotworld.TOP_BLOCK;
filling = plotworld.MAIN_BLOCK; filling = plotworld.MAIN_BLOCK;
wallheight = plotworld.WALL_HEIGHT; wallheight = plotworld.WALL_HEIGHT;
roadheight = plotworld.ROAD_HEIGHT; roadheight = plotworld.ROAD_HEIGHT;
plotheight = plotworld.PLOT_HEIGHT; plotheight = plotworld.PLOT_HEIGHT;
// WALL
short[] result_w = getBlock(plotworld.WALL_BLOCK);
this.w_id = result_w[0];
this.w_v = (byte) result_w[1];
// WALL FILLING
short[] result_wf = getBlock(plotworld.WALL_FILLING);
this.wf_id = result_wf[0];
this.wf_v = (byte) result_wf[1];
// ROAD
short[] result_f1 = getBlock(plotworld.ROAD_BLOCK);
this.f1_id = result_f1[0];
this.f1_v = (byte) result_f1[1];
//
// Floor 2
short[] result_f2 = getBlock(plotworld.ROAD_STRIPES);
this.f2_id = result_f2[0];
this.f2_v = (byte) result_f2[1];
//
this.p_id = new short[plotworld.MAIN_BLOCK.length];
this.p_v = new short[plotworld.MAIN_BLOCK.length];
this.f_id = new short[plotworld.TOP_BLOCK.length];
this.f_v = new short[plotworld.TOP_BLOCK.length];
for (int i = 0; i < plotworld.MAIN_BLOCK.length; i++) {
short[] result = getBlock(plotworld.MAIN_BLOCK[i]);
this.p_id[i] = result[0];
this.p_v[i] = result[1];
}
for (int i = 0; i < plotworld.TOP_BLOCK.length; i++) {
short[] result = getBlock(plotworld.TOP_BLOCK[i]);
this.f_id[i] = result[0];
this.f_v[i] = result[1];
}
if ((this.pathsize % 2) == 0) { if ((this.pathsize % 2) == 0) {
this.pathWidthLower = Math.floor(this.pathsize / 2) - 1; this.pathWidthLower = Math.floor(this.pathsize / 2) - 1;
} else { } else {
@ -175,7 +152,7 @@ public class XPopulator extends BlockPopulator {
// ROADS // ROADS
if ((this.pathsize > 16) && ((plotMinX > roadStartX) || (plotMinZ > roadStartZ)) && !((roadStartX < 16) && (roadStartZ < 16)) && (((roadStartX > 16) && (roadStartZ > 16)) || ((plotMinX > roadStartX) && (plotMinZ > roadStartZ)))) { if ((this.pathsize > 16) && ((plotMinX > roadStartX) || (plotMinZ > roadStartZ)) && !((roadStartX < 16) && (roadStartZ < 16)) && (((roadStartX > 16) && (roadStartZ > 16)) || ((plotMinX > roadStartX) && (plotMinZ > roadStartZ)))) {
setCuboidRegion(0, 16, 1, this.roadheight + 1, 0, 16, this.f1_id, this.f1_v, w); setCuboidRegion(0, 16, 1, this.roadheight + 1, 0, 16, this.floor1, w);
return; return;
} }
@ -185,7 +162,7 @@ public class XPopulator extends BlockPopulator {
if ((start >= 0) && (start <= 16) && (end < 0)) { if ((start >= 0) && (start <= 16) && (end < 0)) {
end = 16; end = 16;
} }
setCuboidRegion(0, 16, 1, this.roadheight + 1, Math.max(start, 0), Math.min(16, end), this.f1_id, this.f1_v, w); setCuboidRegion(0, 16, 1, this.roadheight + 1, Math.max(start, 0), Math.min(16, end), this.floor1, w);
} }
if (((plotMinX + 1) <= 16) || ((roadStartX <= 16) && (roadStartX > 0))) { if (((plotMinX + 1) <= 16) || ((roadStartX <= 16) && (roadStartX > 0))) {
int start = Math.max((16 - plotMinX - this.pathsize) + 1, (16 - roadStartX) + 1); int start = Math.max((16 - plotMinX - this.pathsize) + 1, (16 - roadStartX) + 1);
@ -193,7 +170,7 @@ public class XPopulator extends BlockPopulator {
if ((start >= 0) && (start <= 16) && (end < 0)) { if ((start >= 0) && (start <= 16) && (end < 0)) {
end = 16; end = 16;
} }
setCuboidRegion(Math.max(start, 0), Math.min(16, end), 1, this.roadheight + 1, 0, 16, this.f1_id, this.f1_v, w); setCuboidRegion(Math.max(start, 0), Math.min(16, end), 1, this.roadheight + 1, 0, 16, this.floor1, w);
} }
// STRIPES // STRIPES
@ -214,8 +191,8 @@ public class XPopulator extends BlockPopulator {
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) { if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
start = 0; start = 0;
} }
setCuboidRegion(0, end, this.roadheight, this.roadheight + 1, 16 - value, (16 - value) + 1, this.f2_id, this.f2_v, w); // setCuboidRegion(0, end, this.roadheight, this.roadheight + 1, 16 - value, (16 - value) + 1, this.floor2, w); //
setCuboidRegion(start, 16, this.roadheight, this.roadheight + 1, 16 - value, (16 - value) + 1, this.f2_id, this.f2_v, w); // setCuboidRegion(start, 16, this.roadheight, this.roadheight + 1, 16 - value, (16 - value) + 1, this.floor2, w); //
} }
if ((plotMinX + 2) <= 16) { if ((plotMinX + 2) <= 16) {
int value = (plotMinX + 2); int value = (plotMinX + 2);
@ -233,8 +210,8 @@ public class XPopulator extends BlockPopulator {
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) { if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
start = 0; start = 0;
} }
setCuboidRegion(16 - value, (16 - value) + 1, this.roadheight, this.roadheight + 1, 0, end, this.f2_id, this.f2_v, w); // setCuboidRegion(16 - value, (16 - value) + 1, this.roadheight, this.roadheight + 1, 0, end, this.floor2, w); //
setCuboidRegion(16 - value, (16 - value) + 1, this.roadheight, this.roadheight + 1, start, 16, this.f2_id, this.f2_v, w); // setCuboidRegion(16 - value, (16 - value) + 1, this.roadheight, this.roadheight + 1, start, 16, this.floor2, w); //
} }
if ((roadStartZ <= 16) && (roadStartZ > 1)) { if ((roadStartZ <= 16) && (roadStartZ > 1)) {
int val = roadStartZ; int val = roadStartZ;
@ -252,8 +229,8 @@ public class XPopulator extends BlockPopulator {
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) { if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
start = 0; start = 0;
} }
setCuboidRegion(0, end, this.roadheight, this.roadheight + 1, (16 - val) + 1, (16 - val) + 2, this.f2_id, this.f2_v, w); setCuboidRegion(0, end, this.roadheight, this.roadheight + 1, (16 - val) + 1, (16 - val) + 2, this.floor2, w);
setCuboidRegion(start, 16, this.roadheight, this.roadheight + 1, (16 - val) + 1, (16 - val) + 2, this.f2_id, this.f2_v, w); setCuboidRegion(start, 16, this.roadheight, this.roadheight + 1, (16 - val) + 1, (16 - val) + 2, this.floor2, w);
} }
if ((roadStartX <= 16) && (roadStartX > 1)) { if ((roadStartX <= 16) && (roadStartX > 1)) {
int val = roadStartX; int val = roadStartX;
@ -271,8 +248,8 @@ public class XPopulator extends BlockPopulator {
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) { if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
start = 0; start = 0;
} }
setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.roadheight, this.roadheight + 1, 0, end, this.f2_id, this.f2_v, w); // setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.roadheight, this.roadheight + 1, 0, end, this.floor2, w); //
setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.roadheight, this.roadheight + 1, start, 16, this.f2_id, this.f2_v, w); // setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.roadheight, this.roadheight + 1, start, 16, this.floor2, w); //
} }
} }
// WALLS // WALLS
@ -292,10 +269,10 @@ public class XPopulator extends BlockPopulator {
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) { if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
start = 0; start = 0;
} }
setCuboidRegion(0, end, 1, this.wallheight + 1, 16 - plotMinZ - 1, 16 - plotMinZ, this.wf_id, this.wf_v, w); setCuboidRegion(0, end, 1, this.wallheight + 1, 16 - plotMinZ - 1, 16 - plotMinZ, this.wallfilling, w);
setCuboidRegion(0, end, this.wallheight + 1, this.wallheight + 2, 16 - plotMinZ - 1, 16 - plotMinZ, this.w_id, this.w_v, w); setCuboidRegion(0, end, this.wallheight + 1, this.wallheight + 2, 16 - plotMinZ - 1, 16 - plotMinZ, this.wall, w);
setCuboidRegion(start, 16, 1, this.wallheight + 1, 16 - plotMinZ - 1, 16 - plotMinZ, this.wf_id, this.wf_v, w); setCuboidRegion(start, 16, 1, this.wallheight + 1, 16 - plotMinZ - 1, 16 - plotMinZ, this.wallfilling, w);
setCuboidRegion(start, 16, this.wallheight + 1, this.wallheight + 2, 16 - plotMinZ - 1, 16 - plotMinZ, this.w_id, this.w_v, w); setCuboidRegion(start, 16, this.wallheight + 1, this.wallheight + 2, 16 - plotMinZ - 1, 16 - plotMinZ, this.wall, w);
} }
if ((plotMinX + 1) <= 16) { if ((plotMinX + 1) <= 16) {
int start, end; int start, end;
@ -312,10 +289,10 @@ public class XPopulator extends BlockPopulator {
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) { if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
start = 0; start = 0;
} }
setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, 1, this.wallheight + 1, 0, end, this.wf_id, this.wf_v, w); setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, 1, this.wallheight + 1, 0, end, this.wallfilling, w);
setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, this.wallheight + 1, this.wallheight + 2, 0, end, this.w_id, this.w_v, w); setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, this.wallheight + 1, this.wallheight + 2, 0, end, this.wall, w);
setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, 1, this.wallheight + 1, start, 16, this.wf_id, this.wf_v, w); setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, 1, this.wallheight + 1, start, 16, this.wallfilling, w);
setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, this.wallheight + 1, this.wallheight + 2, start, 16, this.w_id, this.w_v, w); setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, this.wallheight + 1, this.wallheight + 2, start, 16, this.wall, w);
} }
if ((roadStartZ <= 16) && (roadStartZ > 0)) { if ((roadStartZ <= 16) && (roadStartZ > 0)) {
int start, end; int start, end;
@ -332,10 +309,10 @@ public class XPopulator extends BlockPopulator {
if (!(((plotMinX + 1) <= 16) || (roadStartX <= 16))) { if (!(((plotMinX + 1) <= 16) || (roadStartX <= 16))) {
start = 0; start = 0;
} }
setCuboidRegion(0, end, 1, this.wallheight + 1, 16 - roadStartZ, (16 - roadStartZ) + 1, this.wf_id, this.wf_v, w); setCuboidRegion(0, end, 1, this.wallheight + 1, 16 - roadStartZ, (16 - roadStartZ) + 1, this.wallfilling, w);
setCuboidRegion(0, end, this.wallheight + 1, this.wallheight + 2, 16 - roadStartZ, (16 - roadStartZ) + 1, this.w_id, this.w_v, w); setCuboidRegion(0, end, this.wallheight + 1, this.wallheight + 2, 16 - roadStartZ, (16 - roadStartZ) + 1, this.wall, w);
setCuboidRegion(start, 16, 1, this.wallheight + 1, 16 - roadStartZ, (16 - roadStartZ) + 1, this.wf_id, this.wf_v, w); setCuboidRegion(start, 16, 1, this.wallheight + 1, 16 - roadStartZ, (16 - roadStartZ) + 1, this.wallfilling, w);
setCuboidRegion(start, 16, this.wallheight + 1, this.wallheight + 2, 16 - roadStartZ, (16 - roadStartZ) + 1, this.w_id, this.w_v, w); setCuboidRegion(start, 16, this.wallheight + 1, this.wallheight + 2, 16 - roadStartZ, (16 - roadStartZ) + 1, this.wall, w);
} }
if ((roadStartX <= 16) && (roadStartX > 0)) { if ((roadStartX <= 16) && (roadStartX > 0)) {
int start, end; int start, end;
@ -352,10 +329,10 @@ public class XPopulator extends BlockPopulator {
if (!(((plotMinZ + 1) <= 16) || ((roadStartZ + 1) <= 16))) { if (!(((plotMinZ + 1) <= 16) || ((roadStartZ + 1) <= 16))) {
start = 0; start = 0;
} }
setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, 1, this.wallheight + 1, 0, end, this.wf_id, this.wf_v, w); setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, 1, this.wallheight + 1, 0, end, this.wallfilling, w);
setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, this.wallheight + 1, this.roadheight + 2, 0, end, this.w_id, this.w_v, w); setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, this.wallheight + 1, this.roadheight + 2, 0, end, this.wall, w);
setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, 1, this.wallheight + 1, start, 16, this.wf_id, this.wf_v, w); setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, 1, this.wallheight + 1, start, 16, this.wallfilling, w);
setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, this.wallheight + 1, this.wallheight + 2, start, 16, this.w_id, this.w_v, w); setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, this.wallheight + 1, this.wallheight + 2, start, 16, this.wall, w);
} }
} }
@ -364,36 +341,36 @@ public class XPopulator extends BlockPopulator {
if (this.plotsize > 16) { if (this.plotsize > 16) {
if (roadStartX <= 16) { if (roadStartX <= 16) {
if (roadStartZ <= 16) { if (roadStartZ <= 16) {
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 0, 16 - roadStartZ, this.p_id, this.p_v, w); setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 0, 16 - roadStartZ, this.filling, w);
setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.f_id, this.f_v, w); setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors, w);
} }
if (plotMinZ <= 16) { if (plotMinZ <= 16) {
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 16 - plotMinZ, 16, this.p_id, this.p_v, w); setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 16 - plotMinZ, 16, this.filling, w);
setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.f_id, this.f_v, w); setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors, w);
} }
} else { } else {
if (roadStartZ <= 16) { if (roadStartZ <= 16) {
if (plotMinX > 16) { if (plotMinX > 16) {
setCuboidRegion(0, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.p_id, this.p_v, w); setCuboidRegion(0, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.filling, w);
setCuboidRegion(0, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.f_id, this.f_v, w); setCuboidRegion(0, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors, w);
} }
} }
} }
if (plotMinX <= 16) { if (plotMinX <= 16) {
if (plotMinZ <= 16) { if (plotMinZ <= 16) {
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 16 - plotMinZ, 16, this.p_id, this.p_v, w); setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 16 - plotMinZ, 16, this.filling, w);
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.f_id, this.f_v, w); setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors, w);
} else { } else {
int z = 16 - roadStartZ; int z = 16 - roadStartZ;
if (z < 0) { if (z < 0) {
z = 16; z = 16;
} }
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, z, this.p_id, this.p_v, w); setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, z, this.filling, w);
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, z, this.f_id, this.f_v, w); setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, z, this.plotfloors, w);
} }
if (roadStartZ <= 16) { if (roadStartZ <= 16) {
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.p_id, this.p_v, w); setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.filling, w);
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.f_id, this.f_v, w); setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors, w);
} else { } else {
if (roadStartX <= 16) { if (roadStartX <= 16) {
if (plotMinZ > 16) { if (plotMinZ > 16) {
@ -401,8 +378,8 @@ public class XPopulator extends BlockPopulator {
if (x < 0) { if (x < 0) {
x = 16; x = 16;
} }
setCuboidRegion(0, x, 1, this.plotheight, 0, 16, this.p_id, this.p_v, w); setCuboidRegion(0, x, 1, this.plotheight, 0, 16, this.filling, w);
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, 16, this.f_id, this.f_v, w); setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, 16, this.plotfloors, w);
} }
} }
} }
@ -413,8 +390,8 @@ public class XPopulator extends BlockPopulator {
if (x < 0) { if (x < 0) {
x = 16; x = 16;
} }
setCuboidRegion(0, x, 1, this.plotheight, 16 - plotMinZ, 16, this.p_id, this.p_v, w); setCuboidRegion(0, x, 1, this.plotheight, 16 - plotMinZ, 16, this.filling, w);
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.f_id, this.f_v, w); setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors, w);
} }
} else { } else {
if (roadStartZ > 16) { if (roadStartZ > 16) {
@ -427,11 +404,11 @@ public class XPopulator extends BlockPopulator {
z = 16; z = 16;
} }
if (roadStartX > 16) { if (roadStartX > 16) {
setCuboidRegion(0, x, 1, this.plotheight, 0, z, this.p_id, this.p_v, w); setCuboidRegion(0, x, 1, this.plotheight, 0, z, this.filling, w);
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, z, this.f_id, this.f_v, w); setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, z, this.plotfloors, w);
} else { } else {
setCuboidRegion(0, x, 1, this.plotheight, 0, z, this.p_id, this.p_v, w); setCuboidRegion(0, x, 1, this.plotheight, 0, z, this.filling, w);
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, z, this.f_id, this.f_v, w); setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, z, this.plotfloors, w);
} }
} }
} }
@ -439,22 +416,22 @@ public class XPopulator extends BlockPopulator {
} else { } else {
if (roadStartX <= 16) { if (roadStartX <= 16) {
if (roadStartZ <= 16) { if (roadStartZ <= 16) {
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 0, 16 - roadStartZ, this.p_id, this.p_v, w); setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 0, 16 - roadStartZ, this.filling, w);
setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.f_id, this.f_v, w); setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors, w);
} }
if (plotMinZ <= 16) { if (plotMinZ <= 16) {
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 16 - plotMinZ, 16, this.p_id, this.p_v, w); setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 16 - plotMinZ, 16, this.filling, w);
setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.f_id, this.f_v, w); setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors, w);
} }
} }
if (plotMinX <= 16) { if (plotMinX <= 16) {
if (plotMinZ <= 16) { if (plotMinZ <= 16) {
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 16 - plotMinZ, 16, this.p_id, this.p_v, w); setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 16 - plotMinZ, 16, this.filling, w);
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.f_id, this.f_v, w); setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors, w);
} }
if (roadStartZ <= 16) { if (roadStartZ <= 16) {
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.p_id, this.p_v, w); setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.filling, w);
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.f_id, this.f_v, w); setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors, w);
} }
} }
} }