Hows this?

This commit is contained in:
boy0001
2015-09-13 14:04:31 +10:00
parent 1cccdd9d4d
commit 5137b23357
379 changed files with 18471 additions and 28437 deletions

View File

@ -25,8 +25,7 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.BukkitChunkManager;
import com.plotsquared.bukkit.util.BukkitSetBlockManager;
public class AugmentedPopulator extends BlockPopulator
{
public class AugmentedPopulator extends BlockPopulator {
public final PlotWorld plotworld;
public final PlotManager manager;
public final BukkitPlotGenerator generator;
@ -39,9 +38,8 @@ public class AugmentedPopulator extends BlockPopulator
private final int bz;
private final int tx;
private final int tz;
public AugmentedPopulator(final String world, final BukkitPlotGenerator generator, final PlotCluster cluster, final boolean p, final boolean b)
{
public AugmentedPopulator(final String world, final BukkitPlotGenerator generator, final PlotCluster cluster, final boolean p, final boolean b) {
MainUtil.initCache();
PS.log("== NEW AUGMENTED POPULATOR FOR: " + world);
this.cluster = cluster;
@ -52,68 +50,53 @@ public class AugmentedPopulator extends BlockPopulator
this.b = b;
o = (plotworld.TERRAIN == 1) || (plotworld.TERRAIN == 2);
final World bukkitWorld = Bukkit.getWorld(world);
if (cluster != null)
{
if (cluster != null) {
final Location bl = manager.getPlotBottomLocAbs(plotworld, cluster.getP1());
final Location tl = manager.getPlotTopLocAbs(plotworld, cluster.getP2()).add(1, 0, 1);
bx = bl.getX();
bz = bl.getZ();
tx = tl.getX();
tz = tl.getZ();
}
else
{
} else {
bx = Integer.MIN_VALUE;
bz = Integer.MIN_VALUE;
tx = Integer.MAX_VALUE;
tz = Integer.MAX_VALUE;
}
// Add the populator
if (o)
{
if (o) {
bukkitWorld.getPopulators().add(0, this);
}
else
{
} else {
bukkitWorld.getPopulators().add(this);
}
}
public static void removePopulator(final String worldname, final PlotCluster cluster)
{
public static void removePopulator(final String worldname, final PlotCluster cluster) {
final World world = Bukkit.getWorld(worldname);
for (final Iterator<BlockPopulator> iterator = world.getPopulators().iterator(); iterator.hasNext();)
{
for (final Iterator<BlockPopulator> iterator = world.getPopulators().iterator(); iterator.hasNext();) {
final BlockPopulator populator = iterator.next();
if (populator instanceof AugmentedPopulator)
{
if (((AugmentedPopulator) populator).cluster.equals(cluster))
{
if (populator instanceof AugmentedPopulator) {
if (((AugmentedPopulator) populator).cluster.equals(cluster)) {
iterator.remove();
}
}
}
}
public BlockWrapper get(final int x, final int z, final int i, final int j, final short[][] r, final boolean c)
{
public BlockWrapper get(final int x, final int z, final int i, final int j, final short[][] r, final boolean c) {
final int y = (i << 4) + (j >> 8);
final int a = (j - ((y & 0xF) << 8));
final int z1 = (a >> 4);
final int x1 = a - (z1 << 4);
if (r[i] == null)
{
if (r[i] == null) {
return (c && (((z + z1) < bz) || ((z + z1) > tz) || ((x + x1) < bx) || ((x + x1) > tx))) ? null : new BlockWrapper(x1, y, z1, (short) 0, (byte) 0);
}
else
{
} else {
return (c && (((z + z1) < bz) || ((z + z1) > tz) || ((x + x1) < bx) || ((x + x1) > tx))) ? null : new BlockWrapper(x1, y, z1, r[i][j], (byte) 0);
}
}
@Override
public void populate(final World world, final Random rand, final Chunk chunk)
{
public void populate(final World world, final Random rand, final Chunk chunk) {
final int cx = chunk.getX();
final int cz = chunk.getZ();
final int bx = cx << 4;
@ -126,30 +109,24 @@ public class AugmentedPopulator extends BlockPopulator
final boolean inZ2 = ((tz >= this.bz) && (tz <= this.tz));
final boolean inX = inX1 || inX2;
final boolean inZ = inZ1 || inZ2;
if (!inX || !inZ) { return; }
if (plotworld.TERRAIN == 3)
{
if (!inX || !inZ) {
return;
}
if (plotworld.TERRAIN == 3) {
final int X = chunk.getX() << 4;
final int Z = chunk.getZ() << 4;
if (ChunkManager.FORCE_PASTE)
{
for (short x = 0; x < 16; x++)
{
for (short z = 0; z < 16; z++)
{
if (ChunkManager.FORCE_PASTE) {
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
final PlotLoc loc = new PlotLoc((short) (X + x), (short) (Z + z));
final HashMap<Short, Short> blocks = ChunkManager.GENERATE_BLOCKS.get(loc);
final HashMap<Short, Byte> datas = ChunkManager.GENERATE_DATA.get(loc);
for (final Entry<Short, Short> entry : blocks.entrySet())
{
for (final Entry<Short, Short> entry : blocks.entrySet()) {
final int y = entry.getKey();
byte data;
if (datas != null)
{
if (datas != null) {
data = datas.get(y);
}
else
{
} else {
data = 0;
}
BukkitSetBlockManager.setBlockManager.set(world, x, y, z, blocks.get(y), data);
@ -158,31 +135,23 @@ public class AugmentedPopulator extends BlockPopulator
}
return;
}
if (ChunkManager.CURRENT_PLOT_CLEAR != null)
{
if (ChunkManager.CURRENT_PLOT_CLEAR != null) {
PlotLoc loc;
for (final Entry<PlotLoc, HashMap<Short, Byte>> entry : ChunkManager.GENERATE_DATA.entrySet())
{
for (final Entry<PlotLoc, HashMap<Short, Byte>> entry : ChunkManager.GENERATE_DATA.entrySet()) {
final HashMap<Short, Byte> datas = ChunkManager.GENERATE_DATA.get(entry.getKey());
for (final Entry<Short, Byte> entry2 : entry.getValue().entrySet())
{
for (final Entry<Short, Byte> entry2 : entry.getValue().entrySet()) {
final Short y = entry2.getKey();
byte data;
if (datas != null)
{
if (datas != null) {
data = datas.get(y);
}
else
{
} else {
data = 0;
}
loc = entry.getKey();
final int xx = loc.x - X;
final int zz = loc.z - Z;
if ((xx >= 0) && (xx < 16))
{
if ((zz >= 0) && (zz < 16))
{
if ((xx >= 0) && (xx < 16)) {
if ((zz >= 0) && (zz < 16)) {
BukkitSetBlockManager.setBlockManager.set(world, xx, y, zz, entry2.getValue(), data);
}
}
@ -193,118 +162,86 @@ public class AugmentedPopulator extends BlockPopulator
}
final boolean check;
check = !inX1 || !inX2 || !inZ1 || !inZ2;
if (plotworld.TERRAIN > 1)
{
if (plotworld.TERRAIN > 1) {
final PlotId plot1 = manager.getPlotIdAbs(plotworld, bx, 0, bz);
final PlotId plot2 = manager.getPlotIdAbs(plotworld, tx, 0, tz);
if ((plot1 != null) && (plot2 != null) && plot1.equals(plot2)) { return; }
if ((plot1 != null) && (plot2 != null) && plot1.equals(plot2)) {
return;
}
}
if (o)
{
if (o) {
populateBlocks(world, rand, cx, cz, bx, bz, check);
}
else
{
TaskManager.runTaskLater(new Runnable()
{
} else {
TaskManager.runTaskLater(new Runnable() {
@Override
public void run()
{
public void run() {
populateBiome(world, bx, bz);
}
}, 20 + rand.nextInt(10));
TaskManager.runTaskLater(new Runnable()
{
TaskManager.runTaskLater(new Runnable() {
@Override
public void run()
{
public void run() {
chunk.load(true);
populateBlocks(world, rand, cx, cz, bx, bz, check);
}
}, 40 + rand.nextInt(40));
}
}
private void populateBiome(final World world, final int x, final int z)
{
private void populateBiome(final World world, final int x, final int z) {
final Biome biome = Biome.valueOf(plotworld.PLOT_BIOME);
if (b)
{
for (int i = 0; i < 16; i++)
{
for (int j = 0; j < 16; j++)
{
if (b) {
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
world.setBiome(x + i, z + j, biome);
}
}
}
}
private void populateBlocks(final World world, final Random rand, final int X, final int Z, final int x, final int z, final boolean check)
{
private void populateBlocks(final World world, final Random rand, final int X, final int Z, final int x, final int z, final boolean check) {
final short[][] result = generator.generateExtBlockSections(world, rand, X, Z, null);
for (int i = 0; i < result.length; i++)
{
if (result[i] != null)
{
for (int j = 0; j < 4096; j++)
{
for (int i = 0; i < result.length; i++) {
if (result[i] != null) {
for (int j = 0; j < 4096; j++) {
final int x1 = MainUtil.x_loc[i][j];
final int y = MainUtil.y_loc[i][j];
final int z1 = MainUtil.z_loc[i][j];
final short id = result[i][j];
final int xx = x + x1;
final int zz = z + z1;
if (check && (((zz) < bz) || ((zz) > tz) || ((xx) < bx) || ((xx) > tx)))
{
if (check && (((zz) < bz) || ((zz) > tz) || ((xx) < bx) || ((xx) > tx))) {
continue;
}
if (p)
{
if (ChunkManager.CURRENT_PLOT_CLEAR != null)
{
if (BukkitChunkManager.isIn(ChunkManager.CURRENT_PLOT_CLEAR, xx, zz))
{
if (p) {
if (ChunkManager.CURRENT_PLOT_CLEAR != null) {
if (BukkitChunkManager.isIn(ChunkManager.CURRENT_PLOT_CLEAR, xx, zz)) {
continue;
}
}
else if (manager.getPlotIdAbs(plotworld, xx, 0, zz) != null)
{
} else if (manager.getPlotIdAbs(plotworld, xx, 0, zz) != null) {
continue;
}
}
BukkitSetBlockManager.setBlockManager.set(world, xx, y, zz, id, (byte) 0);
}
}
else
{
} else {
final short y_min = MainUtil.y_loc[i][0];
if (y_min < 128)
{
for (int x1 = x; x1 < (x + 16); x1++)
{
for (int z1 = z; z1 < (z + 16); z1++)
{
if (check && (((z1) < bz) || ((z1) > tz) || ((x1) < bx) || ((x1) > tx)))
{
if (y_min < 128) {
for (int x1 = x; x1 < (x + 16); x1++) {
for (int z1 = z; z1 < (z + 16); z1++) {
if (check && (((z1) < bz) || ((z1) > tz) || ((x1) < bx) || ((x1) > tx))) {
continue;
}
if (p)
{
if (ChunkManager.CURRENT_PLOT_CLEAR != null)
{
if (BukkitChunkManager.isIn(ChunkManager.CURRENT_PLOT_CLEAR, x1, z1))
{
if (p) {
if (ChunkManager.CURRENT_PLOT_CLEAR != null) {
if (BukkitChunkManager.isIn(ChunkManager.CURRENT_PLOT_CLEAR, x1, z1)) {
continue;
}
}
else if (manager.getPlotIdAbs(plotworld, x1, 0, z1) != null)
{
} else if (manager.getPlotIdAbs(plotworld, x1, 0, z1) != null) {
continue;
}
}
for (int y = y_min; y < (y_min + 16); y++)
{
for (int y = y_min; y < (y_min + 16); y++) {
BukkitSetBlockManager.setBlockManager.set(world, x1, y, z1, 0, (byte) 0);
}
}
@ -312,8 +249,7 @@ public class AugmentedPopulator extends BlockPopulator
}
}
}
for (final BlockPopulator populator : generator.getPopulators(world.getName()))
{
for (final BlockPopulator populator : generator.getPopulators(world.getName())) {
final Chunk chunk = world.getChunkAt(X, Z);
populator.populate(world, r, chunk);
}

View File

@ -9,94 +9,80 @@ import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.SetupObject;
public class BukkitGeneratorWrapper extends PlotGenerator<ChunkGenerator>
{
public class BukkitGeneratorWrapper extends PlotGenerator<ChunkGenerator> {
public final boolean full;
public BukkitGeneratorWrapper(final String world, final ChunkGenerator generator)
{
public BukkitGeneratorWrapper(final String world, final ChunkGenerator generator) {
super(world, generator);
full = (generator instanceof BukkitPlotGenerator);
}
@Override
public void initialize(final PlotWorld plotworld)
{
if (generator instanceof BukkitPlotGenerator)
{
public void initialize(final PlotWorld plotworld) {
if (generator instanceof BukkitPlotGenerator) {
((BukkitPlotGenerator) generator).init(plotworld);
}
}
@Override
public void augment(final PlotCluster cluster, final PlotWorld plotworld)
{
if (generator instanceof BukkitPlotGenerator)
{
public void augment(final PlotCluster cluster, final PlotWorld plotworld) {
if (generator instanceof BukkitPlotGenerator) {
final BukkitPlotGenerator plotgen = (BukkitPlotGenerator) generator;
if (cluster != null)
{
if (cluster != null) {
new AugmentedPopulator(world, plotgen, cluster, plotworld.TERRAIN == 2, plotworld.TERRAIN != 2);
}
else
{
} else {
new AugmentedPopulator(world, plotgen, null, plotworld.TERRAIN == 2, plotworld.TERRAIN != 2);
}
}
}
@Override
public void setGenerator(final String gen_string)
{
if (gen_string == null)
{
public void setGenerator(final String gen_string) {
if (gen_string == null) {
generator = new HybridGen(world);
}
else
{
} else {
final PlotGenerator<ChunkGenerator> gen_wrapper = (PlotGenerator<ChunkGenerator>) PS.get().IMP.getGenerator(world, gen_string);
if (gen_wrapper != null)
{
if (gen_wrapper != null) {
generator = gen_wrapper.generator;
}
}
}
@Override
public PlotWorld getNewPlotWorld(final String world)
{
if (!(generator instanceof BukkitPlotGenerator)) { return null; }
public PlotWorld getNewPlotWorld(final String world) {
if (!(generator instanceof BukkitPlotGenerator)) {
return null;
}
return ((BukkitPlotGenerator) generator).getNewPlotWorld(world);
}
@Override
public PlotManager getPlotManager()
{
if (!(generator instanceof BukkitPlotGenerator)) { return null; }
public PlotManager getPlotManager() {
if (!(generator instanceof BukkitPlotGenerator)) {
return null;
}
return ((BukkitPlotGenerator) generator).getPlotManager();
}
@Override
public boolean isFull()
{
public boolean isFull() {
return full;
}
@Override
public String getName()
{
if (generator == null) { return "Null"; }
public String getName() {
if (generator == null) {
return "Null";
}
return generator.getClass().getName();
}
@Override
public void processSetup(final SetupObject object)
{
if (generator instanceof BukkitPlotGenerator)
{
public void processSetup(final SetupObject object) {
if (generator instanceof BukkitPlotGenerator) {
((BukkitPlotGenerator) generator).processSetup(object);
}
}
}

View File

@ -41,9 +41,8 @@ import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.plotsquared.bukkit.listeners.WorldEvents;
public abstract class BukkitPlotGenerator extends ChunkGenerator
{
public abstract class BukkitPlotGenerator extends ChunkGenerator {
public static short[][][] CACHE_I = null;
public static short[][][] CACHE_J = null;
public int X;
@ -51,25 +50,19 @@ public abstract class BukkitPlotGenerator extends ChunkGenerator
private boolean loaded = false;
private short[][] result;
private final PseudoRandom random = new PseudoRandom();
public BukkitPlotGenerator(final String world)
{
public BukkitPlotGenerator(final String world) {
WorldEvents.lastWorld = world;
initCache();
}
public void initCache()
{
if (CACHE_I == null)
{
public void initCache() {
if (CACHE_I == null) {
CACHE_I = new short[256][16][16];
CACHE_J = new short[256][16][16];
for (int x = 0; x < 16; x++)
{
for (int z = 0; z < 16; z++)
{
for (int y = 0; y < 256; y++)
{
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
for (int y = 0; y < 256; y++) {
final short i = (short) (y >> 4);
final short j = (short) (((y & 0xF) << 8) | (z << 4) | x);
CACHE_I[y][x][z] = i;
@ -79,31 +72,24 @@ public abstract class BukkitPlotGenerator extends ChunkGenerator
}
}
}
@SuppressWarnings("unchecked")
@Override
public List<BlockPopulator> getDefaultPopulators(final World world)
{
try
{
if (!loaded)
{
public List<BlockPopulator> getDefaultPopulators(final World world) {
try {
if (!loaded) {
final String name = WorldEvents.getName(world);
PS.get().loadWorld(name, new BukkitGeneratorWrapper(name, this));
final PlotWorld plotworld = PS.get().getPlotWorld(WorldEvents.getName(world));
if (!plotworld.MOB_SPAWNING)
{
if (!plotworld.SPAWN_EGGS)
{
if (!plotworld.MOB_SPAWNING) {
if (!plotworld.SPAWN_EGGS) {
world.setSpawnFlags(false, false);
}
world.setAmbientSpawnLimit(0);
world.setAnimalSpawnLimit(0);
world.setMonsterSpawnLimit(0);
world.setWaterAnimalSpawnLimit(0);
}
else
{
} else {
world.setSpawnFlags(true, true);
world.setAmbientSpawnLimit(-1);
world.setAnimalSpawnLimit(-1);
@ -113,30 +99,24 @@ public abstract class BukkitPlotGenerator extends ChunkGenerator
loaded = true;
return (List<BlockPopulator>) (List<?>) getPopulators(WorldEvents.getName(world));
}
}
catch (final Exception e)
{
} catch (final Exception e) {
e.printStackTrace();
}
return new ArrayList<BlockPopulator>();
}
/**
* Set the result;
* @param result
*/
public void setResult(final short[][] result)
{
public void setResult(final short[][] result) {
this.result = result;
}
@Override
public short[][] generateExtBlockSections(final World world, final Random r, final int cx, final int cz, final BiomeGrid biomes)
{
try
{
if (!loaded)
{
public short[][] generateExtBlockSections(final World world, final Random r, final int cx, final int cz, final BiomeGrid biomes) {
try {
if (!loaded) {
final String name = WorldEvents.getName(world);
PS.get().loadWorld(name, new BukkitGeneratorWrapper(name, this));
loaded = true;
@ -149,22 +129,17 @@ public abstract class BukkitPlotGenerator extends ChunkGenerator
result = new short[16][];
X = cx << 4;
Z = cz << 4;
if (ChunkManager.FORCE_PASTE)
{
if (ChunkManager.FORCE_PASTE) {
final PlotWorld plotworld = PS.get().getPlotWorld(world.getName());
final Biome biome = Biome.valueOf(plotworld.PLOT_BIOME);
for (short x = 0; x < 16; x++)
{
for (short z = 0; z < 16; z++)
{
if (biomes != null)
{
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
if (biomes != null) {
biomes.setBiome(x, z, biome);
}
final PlotLoc loc = new PlotLoc((X + x), (Z + z));
final HashMap<Short, Short> blocks = ChunkManager.GENERATE_BLOCKS.get(loc);
for (final Entry<Short, Short> entry : blocks.entrySet())
{
for (final Entry<Short, Short> entry : blocks.entrySet()) {
setBlock(x, entry.getKey(), z, entry.getValue());
}
}
@ -172,57 +147,45 @@ public abstract class BukkitPlotGenerator extends ChunkGenerator
return result;
}
generateChunk(world, ChunkManager.CURRENT_PLOT_CLEAR, random, cx, cz, biomes);
if (ChunkManager.CURRENT_PLOT_CLEAR != null)
{
if (ChunkManager.CURRENT_PLOT_CLEAR != null) {
PlotLoc loc;
for (final Entry<PlotLoc, HashMap<Short, Short>> entry : ChunkManager.GENERATE_BLOCKS.entrySet())
{
for (final Entry<Short, Short> entry2 : entry.getValue().entrySet())
{
for (final Entry<PlotLoc, HashMap<Short, Short>> entry : ChunkManager.GENERATE_BLOCKS.entrySet()) {
for (final Entry<Short, Short> entry2 : entry.getValue().entrySet()) {
loc = entry.getKey();
final int xx = loc.x - X;
final int zz = loc.z - Z;
if ((xx >= 0) && (xx < 16))
{
if ((zz >= 0) && (zz < 16))
{
if ((xx >= 0) && (xx < 16)) {
if ((zz >= 0) && (zz < 16)) {
setBlock(xx, entry2.getKey(), zz, entry2.getValue());
}
}
}
}
}
}
catch (final Exception e)
{
} catch (final Exception e) {
e.printStackTrace();
}
return result;
}
public void setBlock(final int x, final int y, final int z, final short blkid)
{
if (result[CACHE_I[y][x][z]] == null)
{
public void setBlock(final int x, final int y, final int z, final short blkid) {
if (result[CACHE_I[y][x][z]] == null) {
result[CACHE_I[y][x][z]] = new short[4096];
}
result[CACHE_I[y][x][z]][CACHE_J[y][x][z]] = blkid;
}
public void setBlock(final int x, final int y, final int z, final short[] blkid)
{
if (blkid.length == 1)
{
public void setBlock(final int x, final int y, final int z, final short[] blkid) {
if (blkid.length == 1) {
setBlock(x, y, z, blkid[0]);
}
final short id = blkid[random.random(blkid.length)];
if (result[CACHE_I[y][x][z]] == null)
{
if (result[CACHE_I[y][x][z]] == null) {
result[CACHE_I[y][x][z]] = new short[4096];
}
result[CACHE_I[y][x][z]][CACHE_J[y][x][z]] = id;
}
/**
* check if a region contains a location. (x, z) must be between [0,15], [0,15]
* @param plot
@ -230,22 +193,20 @@ public abstract class BukkitPlotGenerator extends ChunkGenerator
* @param z
* @return
*/
public boolean contains(final RegionWrapper plot, final int x, final int z)
{
public boolean contains(final RegionWrapper plot, final int x, final int z) {
final int xx = X + x;
final int zz = Z + z;
return ((xx >= plot.minX) && (xx <= plot.maxX) && (zz >= plot.minZ) && (zz <= plot.maxZ));
}
/**
* Allow spawning everywhere
*/
@Override
public boolean canSpawn(final World world, final int x, final int z)
{
public boolean canSpawn(final World world, final int x, final int z) {
return true;
}
/**
* <b>random</b> is an optimized random number generator.<br>
* - Change the state to have the same chunk random each time it generates<br>
@ -266,35 +227,34 @@ public abstract class BukkitPlotGenerator extends ChunkGenerator
* @return
*/
public abstract void generateChunk(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz, final BiomeGrid biomes);
public abstract List<BukkitPlotPopulator> getPopulators(final String world);
/**
* This is called when the generator is initialized.
* You don't need to do anything with it necessarily.
* @param plotworld
*/
public abstract void init(final PlotWorld plotworld);
/**
* Return a new instance of the PlotWorld for a world
* @param world
* @return
*/
public abstract PlotWorld getNewPlotWorld(final String world);
/**
* Get the PlotManager class for this generator
* @return
*/
public abstract PlotManager getPlotManager();
/**
* If you need to do anything fancy for /plot setup<br>
* - Otherwise it will just use the PlotWorld configuration<br>
* Feel free to extend BukkitSetupUtils and customize world creation
* @param object
*/
public void processSetup(final SetupObject object)
{}
public void processSetup(final SetupObject object) {}
}

View File

@ -15,33 +15,27 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.SetBlockQueue;
public abstract class BukkitPlotPopulator extends BlockPopulator
{
public abstract class BukkitPlotPopulator extends BlockPopulator {
private final PseudoRandom random = new PseudoRandom();
public int X;
public int Z;
public String worldname;
private World world;
@Override
public void populate(final World world, final Random rand, final Chunk chunk)
{
public void populate(final World world, final Random rand, final Chunk chunk) {
this.world = world;
worldname = world.getName();
X = chunk.getX() << 4;
Z = chunk.getZ() << 4;
if (ChunkManager.FORCE_PASTE)
{
for (short x = 0; x < 16; x++)
{
for (short z = 0; z < 16; z++)
{
if (ChunkManager.FORCE_PASTE) {
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
final PlotLoc loc = new PlotLoc((short) (X + x), (short) (Z + z));
final HashMap<Short, Byte> blocks = ChunkManager.GENERATE_DATA.get(loc);
for (final Entry<Short, Byte> entry : blocks.entrySet())
{
for (final Entry<Short, Byte> entry : blocks.entrySet()) {
setBlock(x, entry.getKey(), z, entry.getValue());
}
}
@ -49,20 +43,15 @@ public abstract class BukkitPlotPopulator extends BlockPopulator
return;
}
populate(world, ChunkManager.CURRENT_PLOT_CLEAR, random, X, Z);
if (ChunkManager.CURRENT_PLOT_CLEAR != null)
{
if (ChunkManager.CURRENT_PLOT_CLEAR != null) {
PlotLoc loc;
for (final Entry<PlotLoc, HashMap<Short, Byte>> entry : ChunkManager.GENERATE_DATA.entrySet())
{
for (final Entry<Short, Byte> entry2 : entry.getValue().entrySet())
{
for (final Entry<PlotLoc, HashMap<Short, Byte>> entry : ChunkManager.GENERATE_DATA.entrySet()) {
for (final Entry<Short, Byte> entry2 : entry.getValue().entrySet()) {
loc = entry.getKey();
final int xx = loc.x - X;
final int zz = loc.z - Z;
if ((xx >= 0) && (xx < 16))
{
if ((zz >= 0) && (zz < 16))
{
if ((xx >= 0) && (xx < 16)) {
if ((zz >= 0) && (zz < 16)) {
setBlock(xx, entry2.getKey(), zz, entry2.getValue());
}
}
@ -70,9 +59,9 @@ public abstract class BukkitPlotPopulator extends BlockPopulator
}
}
}
public abstract void populate(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz);
/**
* Set the id and data at a location. (x, y, z) must be between [0,15], [0,255], [0,15]
* @param x
@ -81,18 +70,14 @@ public abstract class BukkitPlotPopulator extends BlockPopulator
* @param id
* @param data
*/
public void setBlock(final int x, final int y, final int z, final short id, final byte data)
{
if (data == 0)
{
public void setBlock(final int x, final int y, final int z, final short id, final byte data) {
if (data == 0) {
SetBlockQueue.setBlock(worldname, x, y, z, id);
}
else
{
} else {
SetBlockQueue.setBlock(worldname, x, y, z, new PlotBlock(id, data));
}
}
/**
* Set the data at a location. (x, y, z) must be between [0,15], [0,255], [0,15]
* @param x
@ -100,14 +85,12 @@ public abstract class BukkitPlotPopulator extends BlockPopulator
* @param z
* @param data
*/
public void setBlock(final int x, final int y, final int z, final byte data)
{
if (data != 0)
{
public void setBlock(final int x, final int y, final int z, final byte data) {
if (data != 0) {
world.getBlockAt(X + x, y, Z + z).setData(data);
}
}
/**
* Like setblock, but lacks the data != 0 check
* @param x
@ -115,11 +98,10 @@ public abstract class BukkitPlotPopulator extends BlockPopulator
* @param z
* @param data
*/
public void setBlockAbs(final int x, final int y, final int z, final byte data)
{
public void setBlockAbs(final int x, final int y, final int z, final byte data) {
world.getBlockAt(X + x, y, Z + z).setData(data);
}
/**
* check if a region contains a location. (x, z) must be between [0,15], [0,15]
* @param plot
@ -127,11 +109,10 @@ public abstract class BukkitPlotPopulator extends BlockPopulator
* @param z
* @return
*/
public boolean contains(final RegionWrapper plot, final int x, final int z)
{
public boolean contains(final RegionWrapper plot, final int x, final int z) {
final int xx = X + x;
final int zz = Z + z;
return ((xx >= plot.minX) && (xx <= plot.maxX) && (zz >= plot.minZ) && (zz <= plot.maxZ));
}
}

View File

@ -43,14 +43,12 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
* mean world generation may take somewhat longer
*
*/
public class HybridGen extends BukkitPlotGenerator
{
*/
public class HybridGen extends BukkitPlotGenerator {
public HybridGen(final String world) {
super(world);
super(world);
}
/**
@ -79,15 +77,13 @@ public class HybridGen extends BukkitPlotGenerator
short pathWidthLower;
short pathWidthUpper;
boolean doState = false;
int maxY = 0;
int maxY = 0;
short[][] cached;
/**
* Initialize variables, and create plotworld object used in calculations
*/
@Override
public void init(final PlotWorld plotworld)
{
*/
@Override
public void init(final PlotWorld plotworld) {
if (plotworld != null) {
this.plotworld = (HybridPlotWorld) plotworld;
@ -97,185 +93,143 @@ public class HybridGen extends BukkitPlotGenerator
roadblock = this.plotworld.ROAD_BLOCK.id;
wallfilling = this.plotworld.WALL_FILLING.id;
size = pathsize + plotsize;
wall = this.plotworld.WALL_BLOCK.id;
plotfloors = new short[this.plotworld.TOP_BLOCK.length];
wall = this.plotworld.WALL_BLOCK.id;
plotfloors = new short[this.plotworld.TOP_BLOCK.length];
for (int i = 0; i < this.plotworld.TOP_BLOCK.length; i++) {
plotfloors[i] = this.plotworld.TOP_BLOCK[i].id;
}
filling = new short[this.plotworld.MAIN_BLOCK.length];
}
filling = new short[this.plotworld.MAIN_BLOCK.length];
for (int i = 0; i < this.plotworld.MAIN_BLOCK.length; i++) {
filling[i] = this.plotworld.MAIN_BLOCK[i].id;
}
filling[i] = this.plotworld.MAIN_BLOCK[i].id;
}
if ((filling.length > 1) || (plotfloors.length > 1)) {
doState = true;
}
wallheight = this.plotworld.WALL_HEIGHT;
roadheight = this.plotworld.ROAD_HEIGHT;
plotheight = this.plotworld.PLOT_HEIGHT;
roadheight = this.plotworld.ROAD_HEIGHT;
plotheight = this.plotworld.PLOT_HEIGHT;
if (pathsize == 0) {
pathWidthLower = (short) -1;
pathWidthUpper = (short) (plotsize + 1);
}
else
{
pathWidthLower = (short) -1;
pathWidthUpper = (short) (plotsize + 1);
} else {
{
pathWidthLower = (short) (Math.floor(pathsize / 2) - 1);
}
if ((pathsize % 2) == 0) {
pathWidthLower = (short) (Math.floor(pathsize / 2) - 1);
} else {
pathWidthLower = (short) (Math.floor(pathsize / 2));
}
pathWidthUpper = (short) (pathWidthLower + plotsize + 1);
}
biome = Biome.valueOf(this.plotworld.PLOT_BIOME);
}
biome = Biome.valueOf(this.plotworld.PLOT_BIOME);
{
maxY = Bukkit.getWorld(plotworld.worldname).getMaxHeight();
}
catch (final NullPointerException e)
{}
try {
maxY = Bukkit.getWorld(plotworld.worldname).getMaxHeight();
} catch (final NullPointerException e) {}
if (maxY == 0) {
maxY = 256;
maxY = 256;
}
// create cached chunk (for optimized chunk generation)
// create cached chunk (for optimized chunk generation)
{
cached = new short[(plotheight + 16) / 16][];
if (!this.plotworld.PLOT_SCHEMATIC) {
cached = new short[(plotheight + 16) / 16][];
for (int i = 0; i < cached.length; i++) {
cached[i] = new short[4096];
}
final PseudoRandom random = new PseudoRandom();
for (int x = 0; x < 16; x++)
{
}
final PseudoRandom random = new PseudoRandom();
for (int x = 0; x < 16; x++) {
{
cached[CACHE_I[plotheight][x][z]][CACHE_J[plotheight][x][z]] = plotfloors[random.random(plotfloors.length)];
for (int z = 0; z < 16; z++) {
cached[CACHE_I[plotheight][x][z]][CACHE_J[plotheight][x][z]] = plotfloors[random.random(plotfloors.length)];
if (this.plotworld.PLOT_BEDROCK) {
cached[CACHE_I[0][x][z]][CACHE_J[0][x][z]] = 7;
}
cached[CACHE_I[0][x][z]][CACHE_J[0][x][z]] = 7;
}
for (int y = 1; y < plotheight; y++) {
cached[CACHE_I[y][x][z]][CACHE_J[y][x][z]] = filling[random.random(filling.length)];
}
}
}
}
}
}
/**
* Return the plot manager for this type of generator, or create one For square plots you may as well use the
* default plot manager which comes with PlotSquared
*/
@Override
public PlotManager getPlotManager()
{
*/
@Override
public PlotManager getPlotManager() {
if (HybridGen.manager == null) {
HybridGen.manager = new HybridPlotManager();
}
return HybridGen.manager;
return HybridGen.manager;
}
/**
* Get a new plotworld class For square plots you can use the DefaultPlotWorld class which comes with PlotSquared
*/
@Override
public PlotWorld getNewPlotWorld(final String world)
{
*/
@Override
public PlotWorld getNewPlotWorld(final String world) {
if (plotworld == null) {
plotworld = new HybridPlotWorld(world);
}
return plotworld;
return plotworld;
}
/**
* Return the block populator
*/
@Override
*/
@Override
public List<BukkitPlotPopulator> getPopulators(final String world) {
// You can have as many populators as you would like, e.g. tree
// populator, ore populator
return Arrays.asList((BukkitPlotPopulator) new HybridPop(plotworld));
return Arrays.asList((BukkitPlotPopulator) new HybridPop(plotworld));
}
/**
* 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 void generateChunk(final World world, final RegionWrapper region, final PseudoRandom random, final int cx, final int cz, final BiomeGrid biomes) {
int sx = (short) ((X - plotworld.ROAD_OFFSET_X) % size);
int sz = (short) ((Z - plotworld.ROAD_OFFSET_Z) % size);
int sx = (short) ((X - plotworld.ROAD_OFFSET_X) % size);
int sz = (short) ((Z - plotworld.ROAD_OFFSET_Z) % size);
if (sx < 0) {
sx += size;
}
sx += size;
}
if (sz < 0) {
sz += size;
}
if (biomes != null)
{
for (short x = 0; x < 16; x++)
{
sz += size;
}
if (biomes != null) {
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
biomes.setBiome(x, z, biome);
}
}
}
if (cached != null)
{
}
}
if (cached != null) {
if ((sx > pathWidthLower) && (sz > pathWidthLower) && ((sx + 15) < pathWidthUpper) && ((sz + 15) < pathWidthUpper)) {
setResult(cached);
return;
}
}
if (plotworld.PLOT_BEDROCK)
{
for (short x = 0; x < 16; x++)
{
}
}
if (plotworld.PLOT_BEDROCK) {
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
setBlock(x, 0, z, (short) 7);
}
}
}
if (region != null)
{
}
}
if (region != null) {
{
final int absX = ((sx + x) % size);
for (short z = 0; z < 16; z++)
{
if (contains(region, x, z))
{
for (short x = 0; x < 16; x++) {
final int absX = ((sx + x) % size);
for (short z = 0; z < 16; z++) {
if (contains(region, x, z)) {
for (short y = 1; y < plotheight; y++) {
setBlock(x, y, z, filling);
}
setBlock(x, plotheight, z, plotfloors);
final int absZ = ((sz + z) % size);
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Short> blocks = plotworld.G_SCH.get(loc);
if (blocks != null)
{
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Short> blocks = plotworld.G_SCH.get(loc);
if (blocks != null) {
for (final Entry<Short, Short> entry : blocks.entrySet()) {
setBlock(x, plotheight + entry.getKey(), z, entry.getValue());
@ -284,68 +238,51 @@ public class HybridGen extends BukkitPlotGenerator
}
}
}
return;
}
return;
}
for (short x = 0; x < 16; x++) {
final int absX = ((sx + x) % size);
final boolean gx = absX > pathWidthLower;
final boolean lx = absX < pathWidthUpper;
final boolean gx = absX > pathWidthLower;
final boolean lx = absX < pathWidthUpper;
for (short z = 0; z < 16; z++) {
final int absZ = ((sz + z) % size);
final boolean gz = absZ > pathWidthLower;
final boolean lz = absZ < pathWidthUpper;
// inside plot
if (gx && gz && lx && lz)
{
final boolean lz = absZ < pathWidthUpper;
// inside plot
if (gx && gz && lx && lz) {
for (short y = 1; y < plotheight; y++) {
setBlock(x, y, z, filling);
}
setBlock(x, plotheight, z, plotfloors);
}
setBlock(x, plotheight, z, plotfloors);
if (plotworld.PLOT_SCHEMATIC) {
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Short> blocks = plotworld.G_SCH.get(loc);
if (blocks != null)
{
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Short> blocks = plotworld.G_SCH.get(loc);
if (blocks != null) {
for (final Entry<Short, Short> entry : blocks.entrySet()) {
setBlock(x, plotheight + entry.getKey(), z, entry.getValue());
}
}
}
}
}
}
{
// wall
if (((absX >= pathWidthLower) && (absX <= pathWidthUpper) && (absZ >= pathWidthLower) && (absZ <= pathWidthUpper)))
{
} else if (pathsize != 0) {
// wall
if (((absX >= pathWidthLower) && (absX <= pathWidthUpper) && (absZ >= pathWidthLower) && (absZ <= pathWidthUpper))) {
for (short y = 1; y <= wallheight; y++) {
setBlock(x, y, z, wallfilling);
}
setBlock(x, y, z, wallfilling);
}
if (!plotworld.ROAD_SCHEMATIC_ENABLED) {
setBlock(x, wallheight + 1, z, wall);
}
}
// road
else
{
}
// road
else {
for (short y = 1; y <= roadheight; y++) {
setBlock(x, y, z, roadblock);
}
}
}
}
if (plotworld.ROAD_SCHEMATIC_ENABLED) {
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Short> blocks = plotworld.G_SCH.get(loc);
if (blocks != null)
{
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Short> blocks = plotworld.G_SCH.get(loc);
if (blocks != null) {
for (final Entry<Short, Short> entry : blocks.entrySet()) {
setBlock(x, roadheight + entry.getKey(), z, entry.getValue());

View File

@ -17,8 +17,7 @@ import com.intellectualcrafters.plot.util.BlockManager;
/**
*/
public class HybridPop extends BukkitPlotPopulator
*/
public class HybridPop extends BukkitPlotPopulator {
/*
* Sorry, this isn't well documented at the moment.
@ -42,9 +41,8 @@ public class HybridPop extends BukkitPlotPopulator
Biome biome;
private long state;
private boolean doFilling = false;
private boolean doFloor = false;
public HybridPop(final PlotWorld pw)
private boolean doFloor = false;
public HybridPop(final PlotWorld pw) {
plotworld = (HybridPlotWorld) pw;
// save configuration
@ -56,125 +54,95 @@ public class HybridPop extends BukkitPlotPopulator
wall = plotworld.WALL_BLOCK.data;
int count1 = 0;
int count2 = 0;
plotfloors = new byte[plotworld.TOP_BLOCK.length];
for (int i = 0; i < plotworld.TOP_BLOCK.length; i++)
plotfloors = new byte[plotworld.TOP_BLOCK.length];
for (int i = 0; i < plotworld.TOP_BLOCK.length; i++) {
count1++;
plotfloors[i] = plotworld.TOP_BLOCK[i].data;
if (plotworld.TOP_BLOCK[i].data != 0)
plotfloors[i] = plotworld.TOP_BLOCK[i].data;
if (plotworld.TOP_BLOCK[i].data != 0) {
doFloor = true;
}
}
filling = new byte[plotworld.MAIN_BLOCK.length];
for (int i = 0; i < plotworld.MAIN_BLOCK.length; i++)
filling = new byte[plotworld.MAIN_BLOCK.length];
for (int i = 0; i < plotworld.MAIN_BLOCK.length; i++) {
count2++;
filling[i] = plotworld.MAIN_BLOCK[i].data;
if (plotworld.MAIN_BLOCK[i].data != 0)
filling[i] = plotworld.MAIN_BLOCK[i].data;
if (plotworld.MAIN_BLOCK[i].data != 0) {
doFilling = true;
}
}
if (((count1 > 0) && doFloor) || ((count2 > 0) && doFilling))
}
if (((count1 > 0) && doFloor) || ((count2 > 0) && doFilling)) {}
wallheight = plotworld.WALL_HEIGHT;
roadheight = plotworld.ROAD_HEIGHT;
plotheight = plotworld.PLOT_HEIGHT;
if (pathsize == 0)
plotheight = plotworld.PLOT_HEIGHT;
if (pathsize == 0) {
pathWidthLower = (short) -1;
pathWidthUpper = (short) (plotsize + 1);
}
else
{
if ((pathsize % 2) == 0)
pathWidthUpper = (short) (plotsize + 1);
} else {
if ((pathsize % 2) == 0) {
pathWidthLower = (short) (Math.floor(pathsize / 2) - 1);
}
else
pathWidthLower = (short) (Math.floor(pathsize / 2) - 1);
} else {
pathWidthLower = (short) (Math.floor(pathsize / 2));
}
pathWidthUpper = (short) (pathWidthLower + plotsize + 1);
}
}
public final long nextLong()
}
public final long nextLong() {
final long a = state;
state = xorShift64(a);
return a;
}
public final long xorShift64(long a)
}
public final long xorShift64(long a) {
a ^= (a << 21);
a ^= (a >>> 35);
a ^= (a << 4);
return a;
}
public final int random(final int n)
}
public final int random(final int n) {
final long result = ((nextLong() >>> 32) * n) >> 32;
return (int) result;
}
}
@Override
public void populate(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz)
@Override
public void populate(final World world, final RegionWrapper requiredRegion, final PseudoRandom random, final int cx, final int cz) {
PS.get().getPlotManager(world.getName());
PS.get().getPlotManager(world.getName());
int sx = (short) ((X - plotworld.ROAD_OFFSET_X) % size);
int sz = (short) ((Z - plotworld.ROAD_OFFSET_Z) % size);
if (sx < 0)
int sz = (short) ((Z - plotworld.ROAD_OFFSET_Z) % size);
if (sx < 0) {
sx += size;
}
if (sz < 0)
}
if (sz < 0) {
sz += size;
}
if (requiredRegion != null)
{
for (short x = 0; x < 16; x++)
{
for (short z = 0; z < 16; z++)
{
if (contains(requiredRegion, x, z))
{
if (doFilling)
{
for (short y = 1; y < plotheight; y++)
}
if (requiredRegion != null) {
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
if (contains(requiredRegion, x, z)) {
if (doFilling) {
for (short y = 1; y < plotheight; y++) {
setBlock(x, y, z, filling);
}
}
if (doFloor)
}
if (doFloor) {
setBlock(x, (short) plotheight, z, plotfloors);
}
if (plotworld.PLOT_SCHEMATIC)
}
if (plotworld.PLOT_SCHEMATIC) {
final int absX = ((sx + x) % size);
final int absZ = ((sz + z) % size);
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Byte> blocks = plotworld.G_SCH_DATA.get(loc);
if (blocks != null)
{
for (final short y : blocks.keySet())
final HashMap<Short, Byte> blocks = plotworld.G_SCH_DATA.get(loc);
if (blocks != null) {
for (final short y : blocks.keySet()) {
setBlockAbs(x, (short) (plotheight + y), z, blocks.get(y));
}
}
if (plotworld.G_SCH_STATE != null)
}
if (plotworld.G_SCH_STATE != null) {
final HashSet<PlotItem> states = plotworld.G_SCH_STATE.get(loc);
if (states != null)
{
for (final PlotItem items : states)
final HashSet<PlotItem> states = plotworld.G_SCH_STATE.get(loc);
if (states != null) {
for (final PlotItem items : states) {
BlockManager.manager.addItems(plotworld.worldname, items);
}
@ -185,11 +153,9 @@ public class HybridPop extends BukkitPlotPopulator
}
}
return;
}
for (short x = 0; x < 16; x++)
{
for (short z = 0; z < 16; z++)
}
for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) {
final int absX = ((sx + x) % size);
final int absZ = ((sz + z) % size);
@ -197,31 +163,23 @@ public class HybridPop extends BukkitPlotPopulator
final boolean gz = absZ > pathWidthLower;
final boolean lx = absX < pathWidthUpper;
final boolean lz = absZ < pathWidthUpper;
// inside plot
if (gx && gz && lx && lz)
{
for (short y = 1; y < plotheight; y++)
// inside plot
if (gx && gz && lx && lz) {
for (short y = 1; y < plotheight; y++) {
setBlock(x, y, z, filling);
}
setBlock(x, (short) plotheight, z, plotfloors);
if (plotworld.PLOT_SCHEMATIC)
setBlock(x, (short) plotheight, z, plotfloors);
if (plotworld.PLOT_SCHEMATIC) {
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Byte> blocks = plotworld.G_SCH_DATA.get(loc);
if (blocks != null)
{
for (final short y : blocks.keySet())
final HashMap<Short, Byte> blocks = plotworld.G_SCH_DATA.get(loc);
if (blocks != null) {
for (final short y : blocks.keySet()) {
setBlockAbs(x, (short) (plotheight + y), z, blocks.get(y));
}
}
if (plotworld.G_SCH_STATE != null)
}
if (plotworld.G_SCH_STATE != null) {
final HashSet<PlotItem> states = plotworld.G_SCH_STATE.get(loc);
if (states != null)
{
for (final PlotItem items : states)
final HashSet<PlotItem> states = plotworld.G_SCH_STATE.get(loc);
if (states != null) {
for (final PlotItem items : states) {
items.x = X + x;
items.z = Z + z;
@ -229,37 +187,27 @@ public class HybridPop extends BukkitPlotPopulator
}
}
}
}
}
else if (pathsize != 0)
}
} else if (pathsize != 0) {
// wall
if (((absX >= pathWidthLower) && (absX <= pathWidthUpper) && (absZ >= pathWidthLower) && (absZ <= pathWidthUpper)))
{
for (short y = 1; y <= wallheight; y++)
// wall
if (((absX >= pathWidthLower) && (absX <= pathWidthUpper) && (absZ >= pathWidthLower) && (absZ <= pathWidthUpper))) {
for (short y = 1; y <= wallheight; y++) {
setBlock(x, y, z, wallfilling);
}
if (!plotworld.ROAD_SCHEMATIC_ENABLED)
}
if (!plotworld.ROAD_SCHEMATIC_ENABLED) {
setBlock(x, wallheight + 1, z, wall);
}
}
// road
else
{
for (short y = 1; y <= roadheight; y++)
// road
else {
for (short y = 1; y <= roadheight; y++) {
setBlock(x, y, z, roadblock);
}
}
if (plotworld.ROAD_SCHEMATIC_ENABLED)
}
if (plotworld.ROAD_SCHEMATIC_ENABLED) {
final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Byte> blocks = plotworld.G_SCH_DATA.get(loc);
if (blocks != null)
{
for (final short y : blocks.keySet())
final HashMap<Short, Byte> blocks = plotworld.G_SCH_DATA.get(loc);
if (blocks != null) {
for (final short y : blocks.keySet()) {
setBlockAbs(x, (short) (roadheight + y), z, blocks.get(y));
}
@ -268,15 +216,11 @@ public class HybridPop extends BukkitPlotPopulator
}
}
}
}
private void setBlock(final short x, final short y, final short z, final byte[] blkids)
{
if (blkids.length == 1)
}
private void setBlock(final short x, final short y, final short z, final byte[] blkids) {
if (blkids.length == 1) {
setBlock(x, y, z, blkids[0]);
}
else
setBlock(x, y, z, blkids[0]);
} else {
final int i = random(blkids.length);
setBlock(x, y, z, blkids[i]);