Sudo-random plot content with data values

This commit is contained in:
boy0001 2014-09-24 10:41:18 +10:00
parent c07634acc6
commit d919dc0dbd
4 changed files with 299 additions and 144 deletions

View File

@ -86,7 +86,7 @@ public class PlotWorld {
/**
* Default main block: 1
*/
public static String[] MAIN_BLOCK_DEFAULT = new String[] {"1"};
public static String[] MAIN_BLOCK_DEFAULT = new String[] {"1:0"};
/**
* Top blocks
*/
@ -94,7 +94,7 @@ public class PlotWorld {
/**
* Default top blocks: {"2"}
*/
public static String[] TOP_BLOCK_DEFAULT = new String[] {"2"};
public static String[] TOP_BLOCK_DEFAULT = new String[] {"2:0"};
/**
* Wall block

View File

@ -22,12 +22,12 @@ public class SetBlockFast {
public static boolean set(org.bukkit.World world, int x, int y, int z, int blockId, byte data) {
Object w = methodGetHandle.of(world).call();
Object chunk = methodGetChunkAt.of(w).call(x >> 4, z >> 4);
Object block = methodGetById.of(null).call(blockId);
methodA.of(chunk).call(x & 0x0f, y, z & 0x0f,block , data);
return true;
}
public static void update(Player player) {
for (int cx = -8; cx < 8; cx++) {
for (int cz = -8; cz < 8; cz++) {

View File

@ -22,6 +22,24 @@ import static com.intellectualcrafters.plot.PlotWorld.*;
*
*/
public class WorldGenerator extends ChunkGenerator {
private long state = 100;
public final long nextLong() {
long a=state;
state = xorShift64(a);
return a;
}
public final long xorShift64(long a) {
a ^= (a << 21);
a ^= (a >>> 35);
a ^= (a << 4);
return a;
}
public final int random(int n) {
long r = ((nextLong()>>>32)*n)>>32;
return (int) r;
}
short[][] result;
int plotsize;
int pathsize;
@ -36,22 +54,8 @@ public class WorldGenerator extends ChunkGenerator {
int wallheight;
int plotheight;
Short[] plotfloors;
Short[] filling;
public short getFilling(Random random) {
if (filling.length==1) {
return filling[0];
}
return filling[random.nextInt(filling.length)];
}
public short getPlotFloor(Random random) {
if (plotfloors.length==1) {
return plotfloors[0];
}
return plotfloors[random.nextInt(plotfloors.length)];
}
short[] plotfloors;
short[] filling;
public Short getBlock(String block) {
if (block.contains(":")) {
@ -131,8 +135,8 @@ public class WorldGenerator extends ChunkGenerator {
size = pathsize + plotsize;
wall = getBlock(plotworld.WALL_BLOCK);
plotfloors = new Short[plotworld.TOP_BLOCK.length];
filling = new Short[plotworld.TOP_BLOCK.length];
plotfloors = new short[plotworld.TOP_BLOCK.length];
filling = new short[plotworld.MAIN_BLOCK.length];
for (int i = 0; i < plotworld.TOP_BLOCK.length; i++) {
plotfloors[i] = getBlock(plotworld.TOP_BLOCK[i]);
@ -156,7 +160,7 @@ public class WorldGenerator extends ChunkGenerator {
@Override
public List<BlockPopulator> getDefaultPopulators(World world) {
return Arrays.asList((BlockPopulator) new XPopulator());
return Arrays.asList((BlockPopulator) new XPopulator(PlotMain.getWorldSettings(world)));
}
@Override
@ -168,12 +172,31 @@ public class WorldGenerator extends ChunkGenerator {
for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) {
for (int y = y1; y < y2; y++) {
setBlock(result, (int) x, y, (int) z, id);
setBlock(result, x, y, z, id);
}
}
}
}
private void setCuboidRegion(int x1, int x2, int y1, int y2, int z1, int z2, short[] id) {
if (id.length==1) {
setCuboidRegion(x1,x2,y1,y2,z1,z2,id[0]);
}
else {
for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) {
for (int y = y1; y < y2; y++) {
int i = random(id.length);
setBlock(result, x, y, z, id[i]);
}
}
}
}
}
@SuppressWarnings("deprecation")
@Override
public short[][] generateExtBlockSections(World world, Random random,
@ -184,10 +207,13 @@ public class WorldGenerator extends ChunkGenerator {
double pathWidthLower;
pathWidthLower = Math.floor(pathsize/2);
if (cx<0)
cx+=((-cx)*(size));
if (cz<0)
cz+=((-cz)*(size));
final int prime = 31;
int h = 1;
h = prime * h + cx;
h = prime * h + cz;
state = h;
cx=cx%size+8*size;
cz=cz%size+8*size;
int absX = (int) (cx*16+16-pathWidthLower-1+8*size);
int absZ = (int) (cz*16+16-pathWidthLower-1+8*size);
int plotMinX = (((absX)%size));
@ -261,8 +287,6 @@ public class WorldGenerator extends ChunkGenerator {
}
if (roadStartZ<=16&&roadStartZ>1) {
int val = roadStartZ;
// if (val==0)
// val+=16-pathsize+2;
int start,end;
if (plotMinX+2<=16)
start = 16-plotMinX-1;
@ -303,37 +327,37 @@ public class WorldGenerator extends ChunkGenerator {
if (plotsize>16) {
if (roadStartX<=16) {
if (roadStartZ<=16) {
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 0, 16-roadStartZ, getFilling(random));
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 0, 16-roadStartZ, getPlotFloor(random));
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 0, 16-roadStartZ, filling);
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 0, 16-roadStartZ, plotfloors);
}
if (plotMinZ<=16) {
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 16-plotMinZ, 16, getFilling(random));
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 16-plotMinZ, 16, getPlotFloor(random));
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 16-plotMinZ, 16, filling);
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 16-plotMinZ, 16, plotfloors);
}
}
else {
if (roadStartZ<=16) {
if (plotMinX>16) {
setCuboidRegion(0, 16, 1, plotheight, 0, 16-roadStartZ, getFilling(random));
setCuboidRegion(0, 16, plotheight, plotheight+1, 0, 16-roadStartZ, getPlotFloor(random));
setCuboidRegion(0, 16, 1, plotheight, 0, 16-roadStartZ, filling);
setCuboidRegion(0, 16, plotheight, plotheight+1, 0, 16-roadStartZ, plotfloors);
}
}
}
if (plotMinX<=16) {
if (plotMinZ<=16) {
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 16-plotMinZ, 16, getFilling(random));
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 16-plotMinZ, 16, getPlotFloor(random));
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 16-plotMinZ, 16, filling);
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 16-plotMinZ, 16, plotfloors);
}
else {
int z = (int) (16-roadStartZ);
if (z<0)
z=16;
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 0, z, getFilling(random));
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 0, z, getPlotFloor(random));
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 0, z, filling);
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 0, z, plotfloors);
}
if (roadStartZ<=16) {
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 0, 16-roadStartZ, getFilling(random));
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 0, 16-roadStartZ, getPlotFloor(random));
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 0, 16-roadStartZ, filling);
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 0, 16-roadStartZ, plotfloors);
}
else {
if (roadStartX<=16) {
@ -341,8 +365,8 @@ public class WorldGenerator extends ChunkGenerator {
int x = (int) (16-roadStartX);
if (x<0)
x=16;
setCuboidRegion(0, x, 1, plotheight, 0, 16, getFilling(random));
setCuboidRegion(0, x, plotheight,plotheight+1, 0, 16, getPlotFloor(random));
setCuboidRegion(0, x, 1, plotheight, 0, 16, filling);
setCuboidRegion(0, x, plotheight,plotheight+1, 0, 16, plotfloors);
}
}
}
@ -353,8 +377,8 @@ public class WorldGenerator extends ChunkGenerator {
int x = (int) (16-roadStartX);
if (x<0)
x=16;
setCuboidRegion(0, x, 1, plotheight, 16-plotMinZ, 16, getFilling(random));
setCuboidRegion(0, x, plotheight, plotheight+1, 16-plotMinZ, 16, getPlotFloor(random));
setCuboidRegion(0, x, 1, plotheight, 16-plotMinZ, 16, filling);
setCuboidRegion(0, x, plotheight, plotheight+1, 16-plotMinZ, 16, plotfloors);
}
}
else {
@ -366,12 +390,12 @@ public class WorldGenerator extends ChunkGenerator {
if (z<0)
z=16;
if (roadStartX>16) {
setCuboidRegion(0, x, 1, plotheight, 0, z, getFilling(random));
setCuboidRegion(0, x, plotheight, plotheight+1, 0, z, getPlotFloor(random));
setCuboidRegion(0, x, 1, plotheight, 0, z, filling);
setCuboidRegion(0, x, plotheight, plotheight+1, 0, z, plotfloors);
}
else {
setCuboidRegion(0, x, 1, plotheight, 0, z, getFilling(random));
setCuboidRegion(0, x, plotheight, plotheight+1, 0, z, getPlotFloor(random));
setCuboidRegion(0, x, 1, plotheight, 0, z, filling);
setCuboidRegion(0, x, plotheight, plotheight+1, 0, z, plotfloors);
}
}
}
@ -380,22 +404,22 @@ public class WorldGenerator extends ChunkGenerator {
else {
if (roadStartX<=16) {
if (roadStartZ<=16) {
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 0, 16-roadStartZ, getFilling(random));
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 0, 16-roadStartZ, getPlotFloor(random));
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 0, 16-roadStartZ, filling);
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 0, 16-roadStartZ, plotfloors);
}
if (plotMinZ<=16) {
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 16-plotMinZ, 16, getFilling(random));
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 16-plotMinZ, 16, getPlotFloor(random));
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 16-plotMinZ, 16, filling);
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 16-plotMinZ, 16, plotfloors);
}
}
if (plotMinX<=16) {
if (plotMinZ<=16) {
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 16-plotMinZ, 16, getFilling(random));
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 16-plotMinZ, 16, getPlotFloor(random));
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 16-plotMinZ, 16, filling);
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 16-plotMinZ, 16, plotfloors);
}
if (roadStartZ<=16) {
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 0, 16-roadStartZ, getFilling(random));
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 0, 16-roadStartZ, getPlotFloor(random));
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 0, 16-roadStartZ, filling);
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 0, 16-roadStartZ, plotfloors);
}
}
}
@ -478,10 +502,6 @@ public class WorldGenerator extends ChunkGenerator {
return result;
}
@SuppressWarnings({ "deprecation", "unused" })
private void setBlock(short[][] result, int x, int y, int z,
Material material) {

View File

@ -14,30 +14,55 @@ import java.util.Random;
*
*/
public class XPopulator extends BlockPopulator {
private SetBlockFast setBlockClass = null;
public XPopulator() {
try {
setBlockClass = new SetBlockFast();
private int X;
private int Z;
private long state;
public final long nextLong() {
long a=state;
state = xorShift64(a);
return a;
}
catch (NoClassDefFoundError e) {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "&cFast plot clearing is currently not enabled.");
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "&c - Please get PlotSquared for "+Bukkit.getVersion()+" for improved performance");
public final long xorShift64(long a) {
a ^= (a << 21);
a ^= (a >>> 35);
a ^= (a << 4);
return a;
}
public final int random(int n) {
long result=((nextLong()>>>32)*n)>>32;
return (int) result;
}
public void setCuboidRegion(int x1,int x2, int y1, int y2, int z1, int z2, short id, byte data, World w) {
if (data!=0) {
if (data==0)
return;
for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) {
for (int y = y1; y < y2; y++) {
if (w.getBlockTypeIdAt(x, y, z)==id)
setBlock(w, x, y, z, id, data);
}
}
}
}
private void setCuboidRegion(int x1, int x2, int y1, int y2, int z1, int z2, short[] id, short[] v, World w) {
if (id.length==1) {
setCuboidRegion(x1,x2,y1,y2,z1,z2,id[0],(byte) v[0],w);
}
else {
for (int x = x1; x < x2; x++) {
for (int z = z1; z < z2; z++) {
for (int y = y1; y < y2; y++) {
int i = random(id.length);
if (v[i]!=0)
setBlock(w, x, y, z, id[i], (byte) v[i]);
}
}
}
}
}
public short[] getBlock(String block) {
if (block.contains(":")) {
String[] split = block.split(":");
@ -46,20 +71,20 @@ public class XPopulator extends BlockPopulator {
return new short[] {Short.parseShort(block),0};
}
@Override
public void populate(World w, Random r, Chunk c) {
PlotWorld plotworld = PlotMain.getWorldSettings(w);
int plotsize = plotworld.PLOT_WIDTH;
int pathsize = plotworld.ROAD_WIDTH;
int wallheight = plotworld.WALL_HEIGHT;
int roadheight = plotworld.ROAD_HEIGHT;
// int plotheight = plotworld.PLOT_HEIGHT;
int size = pathsize + plotsize;
byte w_v, f1_v, wf_v, f2_v;
short w_id, f1_id, wf_id, f2_id;
private int plotsize, pathsize, plotheight, wallheight, roadheight, size;
private byte w_v, f1_v, wf_v, f2_v;
private short w_id, f1_id, wf_id, f2_id;
private short[] p_id, p_v, f_id, f_v;
private double pathWidthLower;
private PlotWorld plotworld;
public XPopulator(PlotWorld plotworld) {
this.plotworld = plotworld;
plotsize = plotworld.PLOT_WIDTH;
pathsize = plotworld.ROAD_WIDTH;
plotheight = plotworld.PLOT_HEIGHT;
wallheight = plotworld.WALL_HEIGHT;
roadheight = plotworld.ROAD_HEIGHT;
size = pathsize + plotsize;
// WALL
short[] result_w = getBlock(plotworld.WALL_BLOCK);
w_id = result_w[0];
@ -82,16 +107,39 @@ public class XPopulator extends BlockPopulator {
f2_v = (byte) result_f1[1];
//
p_id = new short[plotworld.MAIN_BLOCK.length];
p_v = new short[plotworld.MAIN_BLOCK.length];
f_id = new short[plotworld.TOP_BLOCK.length];
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]);
p_id[i] = result[0];
p_v[i] = result[1];
}
for (int i = 0; i < plotworld.TOP_BLOCK.length; i++) {
short[] result = getBlock(plotworld.TOP_BLOCK[i]);
f_id[i] = result[0];
f_v[i] = result[1];
}
pathWidthLower = Math.floor(pathsize/2);
}
@Override
public void populate(World w, Random r, Chunk c) {
int cx = c.getX(), cz = c.getZ();
double pathWidthLower;
pathWidthLower = Math.floor(pathsize/2);
if (cx<0)
cx+=((-cx)*(size));
if (cz<0)
cz+=((-cz)*(size));
double absX = (cx*16+16-pathWidthLower-1+8*size);
double absZ = (cz*16+16-pathWidthLower-1+8*size);
final int prime = 31;
int h = 1;
h = prime * h + cx;
h = prime * h + cz;
state = h;
X = cx << 4;
Z = cz << 4;
cx=cx%size+8*size;
cz=cz%size+8*size;
double absX = (cx*16+16-pathWidthLower-1+8*size), absZ = (cz*16+16-pathWidthLower-1+8*size);
int plotMinX = (int) (((absX)%size));
int plotMinZ = (int) (((absZ)%size));
int roadStartX = (plotMinX + pathsize);
@ -118,9 +166,10 @@ public class XPopulator extends BlockPopulator {
setCuboidRegion(Math.max(start,0), Math.min(16,end), 1, roadheight+1, 0, 16, f1_id, f1_v, w);
}
// STRIPES
if (pathsize>4) {
if ((plotMinZ+2)%size<=16) {
int value = (plotMinZ+2)%size;
if ((plotMinZ+2)<=16) {
int value = (plotMinZ+2);
int start,end;
if (plotMinX+2<=16)
start = 16-plotMinX-1;
@ -133,8 +182,8 @@ public class XPopulator extends BlockPopulator {
if (!(plotMinX+2<=16||roadStartX-1<=16)) {
start = 0;
}
setCuboidRegion(0, end, wallheight, wallheight+1, 16-value, 16-value+1, f2_id, f2_v, w); //
setCuboidRegion(start, 16, wallheight, wallheight+1, 16-value, 16-value+1, f2_id, f2_v, w); //
setCuboidRegion(0, end, roadheight, roadheight+1, 16-value, 16-value+1, f2_id, f2_v, w); //
setCuboidRegion(start, 16, roadheight, roadheight+1, 16-value, 16-value+1, f2_id, f2_v, w); //
}
if ((plotMinX+2)%size<=16) {
int value = (plotMinX+2)%size;
@ -150,13 +199,11 @@ public class XPopulator extends BlockPopulator {
if (!(plotMinZ+2<=16||roadStartZ-1<=16)) {
start = 0;
}
setCuboidRegion( 16-value, 16-value+1,wallheight, wallheight+1, 0, end, f2_id, f2_v, w); //
setCuboidRegion( 16-value, 16-value+1, wallheight, wallheight+1,start, 16, f2_id, f2_v, w); //
setCuboidRegion( 16-value, 16-value+1,roadheight, roadheight+1, 0, end, f2_id, f2_v, w); //
setCuboidRegion( 16-value, 16-value+1, roadheight, roadheight+1,start, 16, f2_id, f2_v, w); //
}
if (roadStartZ<=16&&roadStartZ>0) {
if (roadStartZ<=16&&roadStartZ>1) {
int val = roadStartZ;
if (val==0)
val+=16-pathsize+2;
int start,end;
if (plotMinX+2<=16)
start = 16-plotMinX-1;
@ -169,8 +216,8 @@ public class XPopulator extends BlockPopulator {
if (!(plotMinX+2<=16||roadStartX-1<=16)) {
start = 0;
}
setCuboidRegion(0, end, wallheight, wallheight+1, 16-val+1, 16-val+2, f2_id, f2_v, w); //
setCuboidRegion(start, 16, wallheight, wallheight+1, 16-val+1, 16-val+2, f2_id, f2_v, w); //
setCuboidRegion(0, end, roadheight, roadheight+1, 16-val+1, 16-val+2, f2_id, f2_v, w);
setCuboidRegion(start, 16, roadheight, roadheight+1, 16-val+1, 16-val+2, f2_id, f2_v, w);
}
if (roadStartX<=16&&roadStartX>0) {
int val = roadStartX;
@ -188,11 +235,10 @@ public class XPopulator extends BlockPopulator {
if (!(plotMinZ+2<=16||roadStartZ-1<=16)) {
start = 0;
}
setCuboidRegion(16-val+1, 16-val+2, wallheight, wallheight+1, 0, end, f2_id, f2_v, w); //
setCuboidRegion(16-val+1, 16-val+2, wallheight, wallheight+1, start, 16, f2_id, f2_v, w); //
setCuboidRegion(16-val+1, 16-val+2, roadheight, roadheight+1, 0, end, f2_id, f2_v, w); //
setCuboidRegion(16-val+1, 16-val+2, roadheight, roadheight+1, start, 16, f2_id, f2_v, w); //
}
}
// WALLS
if (pathsize>0) {
if (plotMinZ+1<=16) {
@ -269,22 +315,111 @@ public class XPopulator extends BlockPopulator {
}
}
// TODO PLOT MAIN - How are we going to do the IDs for the actual plot if we have randomized blocks...
// - possibly on plot claiming, we could regenerate using the xpopulator
}
// PLOT
@SuppressWarnings("deprecation")
private void setBlock(World w, int x, int y, int z, short id, byte val) {
if (setBlockClass!=null) {
setBlockClass.set(w, x, y, z, id, val);
if (plotsize>16) {
if (roadStartX<=16) {
if (roadStartZ<=16) {
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 0, 16-roadStartZ, p_id, p_v, w);
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 0, 16-roadStartZ, f_id, f_v, w);
}
if (plotMinZ<=16) {
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 16-plotMinZ, 16, p_id, p_v, w);
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 16-plotMinZ, 16, f_id, f_v, w);
}
}
else {
if (val != 0) {
w.getBlockAt(x, y, z).setTypeIdAndData(id, val, false);
} else {
w.getBlockAt(x, y, z).setTypeId(id);
if (roadStartZ<=16) {
if (plotMinX>16) {
setCuboidRegion(0, 16, 1, plotheight, 0, 16-roadStartZ, p_id, p_v, w);
setCuboidRegion(0, 16, plotheight, plotheight+1, 0, 16-roadStartZ, f_id, f_v, w);
}
}
}
if (plotMinX<=16) {
if (plotMinZ<=16) {
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 16-plotMinZ, 16, p_id, p_v, w);
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 16-plotMinZ, 16, f_id, f_v, w);
}
else {
int z = (int) (16-roadStartZ);
if (z<0)
z=16;
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 0, z, p_id, p_v, w);
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 0, z, f_id, f_v, w);
}
if (roadStartZ<=16) {
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 0, 16-roadStartZ, p_id, p_v, w);
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 0, 16-roadStartZ, f_id, f_v, w);
}
else {
if (roadStartX<=16) {
if (plotMinZ>16) {
int x = (int) (16-roadStartX);
if (x<0)
x=16;
setCuboidRegion(0, x, 1, plotheight, 0, 16, p_id, p_v, w);
setCuboidRegion(0, x, plotheight,plotheight+1, 0, 16, f_id, f_v, w);
}
}
}
}
else {
if (plotMinZ<=16) {
if (roadStartX>16) {
int x = (int) (16-roadStartX);
if (x<0)
x=16;
setCuboidRegion(0, x, 1, plotheight, 16-plotMinZ, 16, p_id, p_v, w);
setCuboidRegion(0, x, plotheight, plotheight+1, 16-plotMinZ, 16, f_id, f_v, w);
}
}
else {
if (roadStartZ>16) {
int x = (int) (16-roadStartX);
if (x<0)
x=16;
int z = (int) (16-roadStartZ);
if (z<0)
z=16;
if (roadStartX>16) {
setCuboidRegion(0, x, 1, plotheight, 0, z, p_id, p_v, w);
setCuboidRegion(0, x, plotheight, plotheight+1, 0, z, f_id, f_v, w);
}
else {
setCuboidRegion(0, x, 1, plotheight, 0, z, p_id, p_v, w);
setCuboidRegion(0, x, plotheight, plotheight+1, 0, z, f_id, f_v, w);
}
}
}
}
}
else {
if (roadStartX<=16) {
if (roadStartZ<=16) {
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 0, 16-roadStartZ, p_id, p_v, w);
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 0, 16-roadStartZ, f_id, f_v, w);
}
if (plotMinZ<=16) {
setCuboidRegion(0, 16-roadStartX, 1, plotheight, 16-plotMinZ, 16, p_id, p_v, w);
setCuboidRegion(0, 16-roadStartX, plotheight, plotheight+1, 16-plotMinZ, 16, f_id, f_v, w);
}
}
if (plotMinX<=16) {
if (plotMinZ<=16) {
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 16-plotMinZ, 16, p_id, p_v, w);
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 16-plotMinZ, 16, f_id, f_v, w);
}
if (roadStartZ<=16) {
setCuboidRegion(16-plotMinX, 16, 1, plotheight, 0, 16-roadStartZ, p_id, p_v, w);
setCuboidRegion(16-plotMinX, 16, plotheight, plotheight+1, 0, 16-roadStartZ, f_id, f_v, w);
}
}
}
}
private void setBlock(World w, int x, int y, int z, short id, byte val) {
w.getBlockAt(X+x, y, Z+z).setData(val, false);
}
}