From 47aef8014b24774ce3d69b73cb4444c5dc2d8978 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Wed, 24 Sep 2014 12:35:42 +1000 Subject: [PATCH] road stripes are now optional (as they are buggy) --- .../intellectualcrafters/plot/PlotWorld.java | 2 ++ .../plot/WorldGenerator.java | 19 ++++++++++--------- .../intellectualcrafters/plot/XPopulator.java | 16 +++++++--------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java index ed36b5141..4578b4c6b 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java @@ -118,6 +118,8 @@ public class PlotWorld { * Road stripes */ public String ROAD_STRIPES; + public boolean ROAD_STRIPES_ENABLED; + public static boolean ROAD_STRIPES_ENABLED_DEFAULT = false; /** * Default road stripes: 35 */ diff --git a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java index 0e78c5609..4af329f3d 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java @@ -40,6 +40,7 @@ public class WorldGenerator extends ChunkGenerator { long r = ((nextLong()>>>32)*n)>>32; return (int) r; } + PlotWorld plotworld; short[][] result; int plotsize; int pathsize; @@ -67,7 +68,7 @@ public class WorldGenerator extends ChunkGenerator { public WorldGenerator(String world) { YamlConfiguration config = PlotMain.config; - PlotWorld plotworld = new PlotWorld(); + plotworld = new PlotWorld(); Map options = new HashMap(); options.put("worlds."+world+".plot_height", PLOT_HEIGHT_DEFAULT); @@ -80,6 +81,7 @@ public class WorldGenerator extends ChunkGenerator { 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.enable_stripes", ROAD_STRIPES_ENABLED_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); @@ -104,6 +106,7 @@ public class WorldGenerator extends ChunkGenerator { plotworld.WALL_BLOCK = config.getString("worlds."+world+".wall.block"); plotworld.ROAD_WIDTH = config.getInt("worlds."+world+".road.width"); plotworld.ROAD_HEIGHT = config.getInt("worlds."+world+".road.height"); + plotworld.ROAD_STRIPES_ENABLED = config.getBoolean("worlds."+world+".road.enable_stripes"); plotworld.ROAD_BLOCK = config.getString("worlds."+world+".road.block"); plotworld.ROAD_STRIPES = config.getString("worlds."+world+".road.stripes"); plotworld.WALL_FILLING = config.getString("worlds."+world+".wall.filling"); @@ -250,7 +253,7 @@ public class WorldGenerator extends ChunkGenerator { } // ROAD STRIPES - if (pathsize>4) { + if (pathsize>4&&plotworld.ROAD_STRIPES_ENABLED) { if ((plotMinZ+2)<=16) { int value = (plotMinZ+2); int start,end; @@ -268,8 +271,8 @@ public class WorldGenerator extends ChunkGenerator { 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) { - int value = (plotMinX+2)%size; + if ((plotMinX+2)<=16) { + int value = (plotMinX+2); int start,end; if (plotMinZ+2<=16) start = 16-plotMinZ-1; @@ -302,10 +305,8 @@ public class WorldGenerator extends ChunkGenerator { 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) { + if (roadStartX<=16&&roadStartX>1) { int val = roadStartX; - if (val==0) - val+=16-pathsize+2; int start,end; if (plotMinZ+2<=16) start = 16-plotMinZ-1; @@ -468,8 +469,8 @@ public class WorldGenerator extends ChunkGenerator { start = 16-plotMinX; else start = 16; - if (roadStartX<=16) - end = 16-roadStartX; + if (roadStartX+1<=16) + end = 16-roadStartX+1; else end = 0; if (!(plotMinX+1<=16||roadStartX<=16)) { diff --git a/PlotSquared/src/com/intellectualcrafters/plot/XPopulator.java b/PlotSquared/src/com/intellectualcrafters/plot/XPopulator.java index fb12c15fb..e2e7c8680 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/XPopulator.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/XPopulator.java @@ -104,7 +104,7 @@ public class XPopulator extends BlockPopulator { // Floor 2 short[] result_f2 = getBlock(plotworld.ROAD_STRIPES); f2_id = result_f2[0]; - f2_v = (byte) result_f1[1]; + f2_v = (byte) result_f2[1]; // p_id = new short[plotworld.MAIN_BLOCK.length]; @@ -167,7 +167,7 @@ public class XPopulator extends BlockPopulator { } // STRIPES - if (pathsize>4) { + if (pathsize>4&&plotworld.ROAD_STRIPES_ENABLED) { if ((plotMinZ+2)<=16) { int value = (plotMinZ+2); int start,end; @@ -185,8 +185,8 @@ public class XPopulator extends BlockPopulator { 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; + if ((plotMinX+2)<=16) { + int value = (plotMinX+2); int start,end; if (plotMinZ+2<=16) start = 16-plotMinZ-1; @@ -219,10 +219,8 @@ public class XPopulator extends BlockPopulator { 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) { + if (roadStartX<=16&&roadStartX>1) { int val = roadStartX; - if (val==0) - val+=16-pathsize+2; int start,end; if (plotMinZ+2<=16) start = 16-plotMinZ-1; @@ -283,8 +281,8 @@ public class XPopulator extends BlockPopulator { start = 16-plotMinX; else start = 16; - if (roadStartX<=16) - end = 16-roadStartX; + if (roadStartX+1<=16) + end = 16-roadStartX+1; else end = 0; if (!(plotMinX+1<=16||roadStartX<=16)) {