From 3c39c6d6e698749e947d0ef2ce986df59d63511d Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 23 Sep 2014 21:12:25 +1000 Subject: [PATCH] fuckn road stipes bitches! --- .../intellectualcrafters/plot/PlotWorld.java | 16 +- .../plot/WorldGenerator.java | 82 ++++++- .../intellectualcrafters/plot/XPopulator.java | 221 ++++++++++++------ 3 files changed, 236 insertions(+), 83 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java index 4b1f499d9..3d66f2263 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java @@ -114,14 +114,14 @@ public class PlotWorld { */ public static String WALL_FILLING_DEFAULT = "1:0"; -// /** -// * Road stripes -// */ -// public int ROAD_STRIPES; -// /** -// * Default road stripes: 35 -// */ -// public static int ROAD_STRIPES_DEFAULT = 35; + /** + * Road stripes + */ + public String ROAD_STRIPES; + /** + * Default road stripes: 35 + */ + public static String ROAD_STRIPES_DEFAULT = "98:0"; // // /** // * Road stripes data value (byte) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java index e1bab94d2..45e829720 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java @@ -81,7 +81,7 @@ public class WorldGenerator extends ChunkGenerator { options.put("worlds."+world+".road_width", ROAD_WIDTH_DEFAULT); options.put("worlds."+world+".road_height", ROAD_HEIGHT_DEFAULT); options.put("worlds."+world+".road_block", ROAD_BLOCK_DEFAULT); -// options.put("worlds."+world+".road_stripes", ROAD_STRIPES_DEFAULT); + options.put("worlds."+world+".road_stripes", ROAD_STRIPES_DEFAULT); options.put("worlds."+world+".wall_filling", WALL_FILLING_DEFAULT); options.put("worlds."+world+".wall_height", WALL_HEIGHT_DEFAULT); options.put("worlds."+world+".schematic_on_claim", SCHEMATIC_ON_CLAIM_DEFAULT); @@ -107,7 +107,7 @@ public class WorldGenerator extends ChunkGenerator { plotworld.ROAD_WIDTH = config.getInt("worlds."+world+".road_width"); plotworld.ROAD_HEIGHT = config.getInt("worlds."+world+".road_height"); plotworld.ROAD_BLOCK = config.getString("worlds."+world+".road_block"); -// plotworld.ROAD_STRIPES = config.getInt("worlds."+world+".road_stripes"); + plotworld.ROAD_STRIPES = config.getString("worlds."+world+".road_stripes"); plotworld.WALL_FILLING = config.getString("worlds."+world+".wall_filling"); plotworld.WALL_HEIGHT = config.getInt("worlds."+world+".wall_height"); plotworld.PLOT_CHAT = config.getBoolean("worlds."+world+".plot_chat"); @@ -132,7 +132,7 @@ public class WorldGenerator extends ChunkGenerator { bottom = (short) Material.BEDROCK.getId(); floor1 = getBlock(plotworld.ROAD_BLOCK); -// floor2 = getBlock(plotworld.ROAD_STRIPES); + floor2 = getBlock(plotworld.ROAD_STRIPES); wallfilling = getBlock(plotworld.WALL_FILLING); size = pathsize + plotsize; wall = getBlock(plotworld.WALL_BLOCK); @@ -229,6 +229,82 @@ public class WorldGenerator extends ChunkGenerator { setCuboidRegion(Math.max(start,0), Math.min(16,end), 1, roadheight+1, 0, 16, floor1); } + // FUCK'N ROAD STRIPES + if (pathsize>4) { + if ((plotMinZ+2)%size<=16) { + double value = (plotMinZ+2)%size; + double start,end; + if (plotMinX+2<=16) + start = 16-plotMinX-1; + else + start = 16; + if (roadStartX-1<=16) + end = 16-roadStartX+1; + else + end = 0; + if (!(plotMinX+2<=16||roadStartX-1<=16)) { + start = 0; + } + setCuboidRegion(0, end, wallheight, wallheight+1, 16-value, 16-value+1, floor2); // + setCuboidRegion(start, 16, wallheight, wallheight+1, 16-value, 16-value+1, floor2); // + } + if ((plotMinX+2)%size<=16) { + double value = (plotMinX+2)%size; + double start,end; + if (plotMinZ+2<=16) + start = 16-plotMinZ-1; + else + start = 16; + if (roadStartZ-1<=16) + end = 16-roadStartZ+1; + else + end = 0; + if (!(plotMinZ+2<=16||roadStartZ-1<=16)) { + start = 0; + } + setCuboidRegion( 16-value, 16-value+1,wallheight, wallheight+1, 0, end, floor2); // + setCuboidRegion( 16-value, 16-value+1, wallheight, wallheight+1,start, 16, floor2); // + } + if (roadStartZ<=16&&roadStartZ>0) { + double val = roadStartZ; + if (val==0) + val+=16-pathsize+2; + double start,end; + if (plotMinX+2<=16) + start = 16-plotMinX-1; + else + start = 16; + if (roadStartX-1<=16) + end = 16-roadStartX+1; + else + end = 0; + if (!(plotMinX+2<=16||roadStartX-1<=16)) { + start = 0; + } + setCuboidRegion(0, end, wallheight, wallheight+1, 16-val+1, 16-val+2, floor2); // + setCuboidRegion(start, 16, wallheight, wallheight+1, 16-val+1, 16-val+2, floor2); // + } + if (roadStartX<=16&&roadStartX>0) { + double val = roadStartX; + if (val==0) + val+=16-pathsize+2; + double start,end; + if (plotMinZ+2<=16) + start = 16-plotMinZ-1; + else + start = 16; + if (roadStartZ-1<=16) + end = 16-roadStartZ+1; + else + end = 0; + if (!(plotMinZ+2<=16||roadStartZ-1<=16)) { + start = 0; + } + setCuboidRegion(16-val+1, 16-val+2, wallheight, wallheight+1, 0, end, floor2); // + setCuboidRegion(16-val+1, 16-val+2, wallheight, wallheight+1, start, 16, floor2); // + } + } + // Plot filling (28/28 cuboids) (10x2 + 4x2) if (plotsize>16) { if (roadStartX<=16) { diff --git a/PlotSquared/src/com/intellectualcrafters/plot/XPopulator.java b/PlotSquared/src/com/intellectualcrafters/plot/XPopulator.java index 650694106..6f2b0d9ce 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/XPopulator.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/XPopulator.java @@ -56,9 +56,9 @@ public class XPopulator extends BlockPopulator { int roadheight = plotworld.ROAD_HEIGHT; int plotheight = plotworld.PLOT_HEIGHT; int size = pathsize + plotsize; - byte w_v, f1_v, wf_v; + byte w_v, f1_v, wf_v, f2_v; - short w_id, f1_id, wf_id; + short w_id, f1_id, wf_id, f2_id; // WALL short[] result_w = getBlock(plotworld.WALL_BLOCK); @@ -77,8 +77,9 @@ public class XPopulator extends BlockPopulator { // // Floor 2 -// f2_id = (short) Settings.ROAD_STRIPES; -// f2_v = (byte) Settings.ROAD_STRIPES_DATA; + short[] result_f2 = getBlock(plotworld.ROAD_STRIPES); + f2_id = result_f1[0]; + f2_v = (byte) result_f1[1]; // int cx = c.getX(), cz = c.getZ(); @@ -117,79 +118,155 @@ public class XPopulator extends BlockPopulator { setCuboidRegion(Math.max(start,0), Math.min(16,end), 1, roadheight+1, 0, 16, f1_id, f1_v, w); } - // WALLS + if (pathsize>4) { + if ((plotMinZ+2)%size<=16) { + int value = (plotMinZ+2)%size; + int start,end; + if (plotMinX+2<=16) + start = 16-plotMinX-1; + else + start = 16; + if (roadStartX-1<=16) + end = 16-roadStartX+1; + else + end = 0; + 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); // + } + if ((plotMinX+2)%size<=16) { + int value = (plotMinX+2)%size; + int start,end; + if (plotMinZ+2<=16) + start = 16-plotMinZ-1; + else + start = 16; + if (roadStartZ-1<=16) + end = 16-roadStartZ+1; + else + end = 0; + 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); // + } + if (roadStartZ<=16&&roadStartZ>0) { + int val = roadStartZ; + if (val==0) + val+=16-pathsize+2; + int start,end; + if (plotMinX+2<=16) + start = 16-plotMinX-1; + else + start = 16; + if (roadStartX-1<=16) + end = 16-roadStartX+1; + else + end = 0; + 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); // + } + if (roadStartX<=16&&roadStartX>0) { + int val = roadStartX; + if (val==0) + val+=16-pathsize+2; + int start,end; + if (plotMinZ+2<=16) + start = 16-plotMinZ-1; + else + start = 16; + if (roadStartZ-1<=16) + end = 16-roadStartZ+1; + else + end = 0; + 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); // + } + } - if (plotMinZ+1<=16) { - int start,end; - if (plotMinX+2<=16) - start = 16-plotMinX-1; - else - start = 16; - if (roadStartX-1<=16) - end = 16-roadStartX+1; - else - end = 0; - if (!(plotMinX+2<=16||roadStartX-1<=16)) { - start = 0; + // WALLS + if (pathsize>0) { + if (plotMinZ+1<=16) { + int start,end; + if (plotMinX+2<=16) + start = 16-plotMinX-1; + else + start = 16; + if (roadStartX-1<=16) + end = 16-roadStartX+1; + else + end = 0; + if (!(plotMinX+2<=16||roadStartX-1<=16)) { + start = 0; + } + setCuboidRegion(0, end, 1, wallheight+1, 16-plotMinZ-1, 16-plotMinZ, wf_id, wf_v, w); + setCuboidRegion(0, end, wallheight+1, wallheight+2, 16-plotMinZ-1, 16-plotMinZ, w_id, w_v, w); + setCuboidRegion(start, 16, 1, wallheight+1, 16-plotMinZ-1, 16-plotMinZ, wf_id, wf_v, w); + setCuboidRegion(start, 16, wallheight+1, wallheight+2, 16-plotMinZ-1, 16-plotMinZ, w_id, w_v, w); } - setCuboidRegion(0, end, 1, wallheight+1, 16-plotMinZ-1, 16-plotMinZ, wf_id, wf_v, w); - setCuboidRegion(0, end, wallheight+1, wallheight+2, 16-plotMinZ-1, 16-plotMinZ, w_id, w_v, w); - setCuboidRegion(start, 16, 1, wallheight+1, 16-plotMinZ-1, 16-plotMinZ, wf_id, wf_v, w); - setCuboidRegion(start, 16, wallheight+1, wallheight+2, 16-plotMinZ-1, 16-plotMinZ, w_id, w_v, w); - } - if (plotMinX+1<=16) { - int start,end; - if (plotMinZ+2<=16) - start = 16-plotMinZ-1; - else - start = 16; - if (roadStartZ-1<=16) - end = 16-roadStartZ+1; - else - end = 0; - if (!(plotMinZ+2<=16||roadStartZ-1<=16)) { - start = 0; + if (plotMinX+1<=16) { + int start,end; + if (plotMinZ+2<=16) + start = 16-plotMinZ-1; + else + start = 16; + if (roadStartZ-1<=16) + end = 16-roadStartZ+1; + else + end = 0; + if (!(plotMinZ+2<=16||roadStartZ-1<=16)) { + start = 0; + } + setCuboidRegion( 16-plotMinX-1, 16-plotMinX, 1, wallheight+1,0, end, wf_id, wf_v, w); + setCuboidRegion( 16-plotMinX-1, 16-plotMinX,wallheight+1, wallheight+2, 0, end, w_id, w_v, w); + setCuboidRegion(16-plotMinX-1, 16-plotMinX, 1, wallheight+1, start, 16, wf_id, wf_v, w); + setCuboidRegion( 16-plotMinX-1, 16-plotMinX, wallheight+1, wallheight+2,start, 16, w_id, w_v, w); } - setCuboidRegion( 16-plotMinX-1, 16-plotMinX, 1, wallheight+1,0, end, wf_id, wf_v, w); - setCuboidRegion( 16-plotMinX-1, 16-plotMinX,wallheight+1, wallheight+2, 0, end, w_id, w_v, w); - setCuboidRegion(16-plotMinX-1, 16-plotMinX, 1, wallheight+1, start, 16, wf_id, wf_v, w); - setCuboidRegion( 16-plotMinX-1, 16-plotMinX, wallheight+1, wallheight+2,start, 16, w_id, w_v, w); - } - if (roadStartZ<=16&&roadStartZ>0) { - int start,end; - if (plotMinX+1<=16) - start = 16-plotMinX; - else - start = 16; - if (roadStartX<=16) - end = 16-roadStartX; - else - end = 0; - if (!(plotMinX+1<=16||roadStartX<=16)) { - start = 0; + if (roadStartZ<=16&&roadStartZ>0) { + int start,end; + if (plotMinX+1<=16) + start = 16-plotMinX; + else + start = 16; + if (roadStartX<=16) + end = 16-roadStartX; + else + end = 0; + if (!(plotMinX+1<=16||roadStartX<=16)) { + start = 0; + } + setCuboidRegion(0, end, 1, wallheight+1, 16-roadStartZ, 16-roadStartZ+1, wf_id, wf_v, w); + setCuboidRegion(0, end, wallheight+1, wallheight+2, 16-roadStartZ, 16-roadStartZ+1, w_id, w_v, w); + setCuboidRegion(start, 16, 1, wallheight+1, 16-roadStartZ, 16-roadStartZ+1, wf_id, wf_v, w); + setCuboidRegion(start, 16, wallheight+1, wallheight+2, 16-roadStartZ, 16-roadStartZ+1, w_id, w_v, w); } - setCuboidRegion(0, end, 1, wallheight+1, 16-roadStartZ, 16-roadStartZ+1, wf_id, wf_v, w); - setCuboidRegion(0, end, wallheight+1, wallheight+2, 16-roadStartZ, 16-roadStartZ+1, w_id, w_v, w); - setCuboidRegion(start, 16, 1, wallheight+1, 16-roadStartZ, 16-roadStartZ+1, wf_id, wf_v, w); - setCuboidRegion(start, 16, wallheight+1, wallheight+2, 16-roadStartZ, 16-roadStartZ+1, w_id, w_v, w); - } - if (roadStartX<=16&&roadStartX>0) { - int start,end; - if (plotMinZ+1<=16) - start = 16-plotMinZ; - else - start = 16; - if (roadStartZ+1<=16) - end = 16-roadStartZ+1; - else - end = 0; - if (!(plotMinZ+1<=16||roadStartZ+1<=16)) { - start = 0; + if (roadStartX<=16&&roadStartX>0) { + int start,end; + if (plotMinZ+1<=16) + start = 16-plotMinZ; + else + start = 16; + if (roadStartZ+1<=16) + end = 16-roadStartZ+1; + else + end = 0; + if (!(plotMinZ+1<=16||roadStartZ+1<=16)) { + start = 0; + } + setCuboidRegion( 16-roadStartX, 16-roadStartX+1, 1, wallheight+1,0, end, wf_id, wf_v, w); + setCuboidRegion( 16-roadStartX, 16-roadStartX+1,wallheight+1, roadheight+2,0, end, w_id, w_v, w); + setCuboidRegion( 16-roadStartX, 16-roadStartX+1, 1, wallheight+1, start, 16,wf_id, wf_v, w); + setCuboidRegion( 16-roadStartX, 16-roadStartX+1,wallheight+1, wallheight+2, start, 16, w_id, w_v, w); } - setCuboidRegion( 16-roadStartX, 16-roadStartX+1, 1, wallheight+1,0, end, wf_id, wf_v, w); - setCuboidRegion( 16-roadStartX, 16-roadStartX+1,wallheight+1, roadheight+2,0, end, w_id, w_v, w); - setCuboidRegion( 16-roadStartX, 16-roadStartX+1, 1, wallheight+1, start, 16,wf_id, wf_v, w); - setCuboidRegion( 16-roadStartX, 16-roadStartX+1,wallheight+1, wallheight+2, start, 16, w_id, w_v, w); } // TODO PLOT MAIN - How are we going to do the IDs for the actual plot if we have randomized blocks...