plot schematic

This commit is contained in:
boy0001 2015-02-11 15:45:52 +11:00
parent 0f7972e3ae
commit cea4609174
4 changed files with 49 additions and 8 deletions

View File

@ -131,9 +131,9 @@ public enum C {
* Setup Stuff * Setup Stuff
*/ */
SETUP_INIT("&6Usage: &7/plot setup <value>"), SETUP_INIT("&6Usage: &7/plot setup <value>"),
SETUP_STEP("&7[&6Step %s&7] &6%s &cExpecting: &6%s&c, Default: &6%s&c>"), SETUP_STEP("&7[&6Step %s&7] &6%s &7- &6Expecting: &7%s &6Default: &7%s"),
SETUP_INVALID_ARG("&c%s is not a valid argument for step %s. To cancel setup use: &6/plot setup cancel"), SETUP_INVALID_ARG("&c%s is not a valid argument for step %s. To cancel setup use: &6/plot setup cancel"),
SETUP_VALID_ARG("&cValue &6%s &cset for step %s"), SETUP_VALID_ARG("&cValue &6%s &cset to %s"),
SETUP_FINISHED("&6Finished setup for world &c%s.\n&4If you are using MULTIVERSE or MULTIWORLD the world should have just been created. Otherwise you will need to add the world manually through the bukkit.yml"), SETUP_FINISHED("&6Finished setup for world &c%s.\n&4If you are using MULTIVERSE or MULTIWORLD the world should have just been created. Otherwise you will need to add the world manually through the bukkit.yml"),
SETUP_WORLD_TAKEN("&c%s is already a registered plotworld"), SETUP_WORLD_TAKEN("&c%s is already a registered plotworld"),
SETUP_MISSING_WORLD("&cYou need to specify a world name (&6/plot setup &l<world>&6 <generator>&c)\n&6Additional commands:\n&c - &6/plot setup <value>\n&c - &6/plot setup back\n&c - &6/plot setup cancel"), SETUP_MISSING_WORLD("&cYou need to specify a world name (&6/plot setup &l<world>&6 <generator>&c)\n&6Additional commands:\n&c - &6/plot setup <value>\n&c - &6/plot setup back\n&c - &6/plot setup cancel"),

View File

@ -248,11 +248,14 @@ public class HybridGen extends PlotGenerator {
} }
this.result = new short[maxY / 16][]; this.result = new short[maxY / 16][];
if (plotworld.PLOT_BEDROCK) {
for (short x = 0; x < 16; x++) { for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) { for (short z = 0; z < 16; z++) {
setBlock(this.result, x, 0, z, (short) 7); setBlock(this.result, x, 0, z, (short) 7);
} }
} }
}
RegionWrapper plot = ChunkManager.CURRENT_PLOT_CLEAR; RegionWrapper plot = ChunkManager.CURRENT_PLOT_CLEAR;
if (plot != null) { if (plot != null) {
@ -330,6 +333,15 @@ public class HybridGen extends PlotGenerator {
setBlock(this.result, x, y, z, this.filling); setBlock(this.result, x, y, z, this.filling);
} }
setBlock(this.result, x, this.plotheight, z, this.plotfloors); setBlock(this.result, x, this.plotheight, z, this.plotfloors);
if (plotworld.PLOT_SCHEMATIC) {
ChunkLoc loc = new ChunkLoc(absX, absZ);
HashMap<Short, Short> blocks = this.plotworld.G_SCH.get(loc);
if (blocks != null) {
for (short y : blocks.keySet()) {
setBlock(this.result, x, this.plotheight + y, z, blocks.get(y));
}
}
}
} else { } else {
// wall // wall
if ((absX >= pathWidthLower && absX <= pathWidthUpper && absZ >= pathWidthLower && absZ <= pathWidthUpper)) if ((absX >= pathWidthLower && absX <= pathWidthUpper && absZ >= pathWidthLower && absZ <= pathWidthUpper))

View File

@ -41,7 +41,6 @@ import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
import com.intellectualcrafters.plot.util.PlotHelper; import com.intellectualcrafters.plot.util.PlotHelper;

View File

@ -131,6 +131,10 @@ public class HybridPlotWorld extends PlotWorld {
* Road block * Road block
*/ */
public PlotBlock ROAD_BLOCK; public PlotBlock ROAD_BLOCK;
/**
* If bedrock is enabled
*/
public boolean PLOT_BEDROCK;
public short PATH_WIDTH_LOWER; public short PATH_WIDTH_LOWER;
public short PATH_WIDTH_UPPER; public short PATH_WIDTH_UPPER;
@ -138,6 +142,8 @@ public class HybridPlotWorld extends PlotWorld {
public short OFFSET; public short OFFSET;
public short SCHEMATIC_HEIGHT; public short SCHEMATIC_HEIGHT;
public boolean PLOT_SCHEMATIC = false;
public short REQUIRED_CHANGES = 0; public short REQUIRED_CHANGES = 0;
/* /*
@ -161,7 +167,7 @@ public class HybridPlotWorld extends PlotWorld {
public ConfigurationNode[] getSettingNodes() { public ConfigurationNode[] getSettingNodes() {
// TODO return a set of configuration nodes (used for setup command) // TODO return a set of configuration nodes (used for setup command)
return new ConfigurationNode[] { new ConfigurationNode("plot.height", HybridPlotWorld.PLOT_HEIGHT_DEFAULT, "Plot height", Configuration.INTEGER, true), new ConfigurationNode("plot.size", HybridPlotWorld.PLOT_WIDTH_DEFAULT, "Plot width", Configuration.INTEGER, true), new ConfigurationNode("plot.filling", HybridPlotWorld.MAIN_BLOCK_DEFAULT, "Plot block", Configuration.BLOCKLIST, true), new ConfigurationNode("plot.floor", HybridPlotWorld.TOP_BLOCK_DEFAULT, "Plot floor block", Configuration.BLOCKLIST, true), new ConfigurationNode("wall.block", HybridPlotWorld.WALL_BLOCK_DEFAULT, "Top wall block", Configuration.BLOCK, true), new ConfigurationNode("wall.block_claimed", HybridPlotWorld.CLAIMED_WALL_BLOCK_DEFAULT, "Wall block (claimed)", Configuration.BLOCK, true), new ConfigurationNode("road.width", HybridPlotWorld.ROAD_WIDTH_DEFAULT, "Road width", Configuration.INTEGER, true), return new ConfigurationNode[] { new ConfigurationNode("plot.height", HybridPlotWorld.PLOT_HEIGHT_DEFAULT, "Plot height", Configuration.INTEGER, true), new ConfigurationNode("plot.size", HybridPlotWorld.PLOT_WIDTH_DEFAULT, "Plot width", Configuration.INTEGER, true), new ConfigurationNode("plot.filling", HybridPlotWorld.MAIN_BLOCK_DEFAULT, "Plot block", Configuration.BLOCKLIST, true), new ConfigurationNode("plot.floor", HybridPlotWorld.TOP_BLOCK_DEFAULT, "Plot floor block", Configuration.BLOCKLIST, true), new ConfigurationNode("wall.block", HybridPlotWorld.WALL_BLOCK_DEFAULT, "Top wall block", Configuration.BLOCK, true), new ConfigurationNode("wall.block_claimed", HybridPlotWorld.CLAIMED_WALL_BLOCK_DEFAULT, "Wall block (claimed)", Configuration.BLOCK, true), new ConfigurationNode("road.width", HybridPlotWorld.ROAD_WIDTH_DEFAULT, "Road width", Configuration.INTEGER, true),
new ConfigurationNode("road.height", HybridPlotWorld.ROAD_HEIGHT_DEFAULT, "Road height", Configuration.INTEGER, true), new ConfigurationNode("road.block", HybridPlotWorld.ROAD_BLOCK_DEFAULT, "Road block", Configuration.BLOCK, true), new ConfigurationNode("wall.filling", HybridPlotWorld.WALL_FILLING_DEFAULT, "Wall filling block", Configuration.BLOCK, true), new ConfigurationNode("wall.height", HybridPlotWorld.WALL_HEIGHT_DEFAULT, "Wall height", Configuration.INTEGER, true), }; new ConfigurationNode("road.height", HybridPlotWorld.ROAD_HEIGHT_DEFAULT, "Road height", Configuration.INTEGER, true), new ConfigurationNode("road.block", HybridPlotWorld.ROAD_BLOCK_DEFAULT, "Road block", Configuration.BLOCK, true), new ConfigurationNode("wall.filling", HybridPlotWorld.WALL_FILLING_DEFAULT, "Wall filling block", Configuration.BLOCK, true), new ConfigurationNode("wall.height", HybridPlotWorld.WALL_HEIGHT_DEFAULT, "Wall height", Configuration.INTEGER, true), new ConfigurationNode("plot.bedrock", true, "Plot bedrock generation", Configuration.BOOLEAN, true) };
} }
/** /**
@ -173,7 +179,7 @@ public class HybridPlotWorld extends PlotWorld {
if (!config.contains("plot.height")) { if (!config.contains("plot.height")) {
PlotMain.sendConsoleSenderMessage(" - &cConfiguration is null? (" + config.getCurrentPath() + ")"); PlotMain.sendConsoleSenderMessage(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
} }
this.PLOT_BEDROCK = config.getBoolean("plot.bedrock");
this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height")); this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height"));
this.PLOT_WIDTH = config.getInt("plot.size"); this.PLOT_WIDTH = config.getInt("plot.size");
this.MAIN_BLOCK = (PlotBlock[]) Configuration.BLOCKLIST.parseString(StringUtils.join(config.getStringList("plot.filling"), ',')); this.MAIN_BLOCK = (PlotBlock[]) Configuration.BLOCKLIST.parseString(StringUtils.join(config.getStringList("plot.filling"), ','));
@ -209,9 +215,11 @@ public class HybridPlotWorld extends PlotWorld {
this.OFFSET = -1 + 1; this.OFFSET = -1 + 1;
String schem1Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/sideroad"; String schem1Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/sideroad";
String schem2Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/intersection"; String schem2Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/intersection";
String schem3Str = "GEN_ROAD_SCHEMATIC/" + worldname + "/plot";
Schematic schem1 = SchematicHandler.getSchematic(schem1Str); Schematic schem1 = SchematicHandler.getSchematic(schem1Str);
Schematic schem2 = SchematicHandler.getSchematic(schem2Str); Schematic schem2 = SchematicHandler.getSchematic(schem2Str);
Schematic schem3 = SchematicHandler.getSchematic(schem3Str);
if (schem1 == null || schem2 == null || this.ROAD_WIDTH == 0) { if (schem1 == null || schem2 == null || this.ROAD_WIDTH == 0) {
PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "&3 - schematic: &7false"); PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "&3 - schematic: &7false");
@ -268,6 +276,28 @@ public class HybridPlotWorld extends PlotWorld {
} }
} }
} }
if (schem3 != null) {
PLOT_SCHEMATIC = true;
DataCollection[] blocks3 = schem3.getBlockCollection();
Dimension d3 = schem3.getSchematicDimension();
short w3 = (short) d3.getX();
short l3 = (short) d3.getZ();
short h3 = (short) d3.getY();
for (short x = 0; x < w3; x++) {
for (short z = 0; z < l3; z++) {
for (short y = 0; y < h3; y++) {
int index = y * w3 * l3 + z * w3 + x;
short id = blocks3[index].getBlock();
byte data = blocks3[index].getData();
if (id != 0) {
addOverlayBlock((short) (x + shift + oddshift), (short) (y + this.OFFSET), (short) (z + shift + oddshift), id, data, false);
}
}
}
}
}
this.ROAD_SCHEMATIC_ENABLED = true; this.ROAD_SCHEMATIC_ENABLED = true;
} }