This commit is contained in:
boy0001 2015-04-22 00:19:46 +10:00
parent 80a3c14189
commit 29cf1326f6
2 changed files with 31 additions and 14 deletions

View File

@ -63,21 +63,26 @@ public class AugmentedPopulator extends BlockPopulator {
} }
} }
private short[][] x_loc; private static short[][] x_loc;
private short[][] y_loc; private static short[][] y_loc;
private short[][] z_loc; private static short[][] z_loc;
public AugmentedPopulator(final String world, final PlotGenerator generator, final PlotCluster cluster, final boolean p, final boolean b) { public AugmentedPopulator(final String world, final PlotGenerator generator, final PlotCluster cluster, final boolean p, final boolean b) {
for (int i = 0; i < 16; i++) { if (x_loc == null) {
int i4 = i << 4; x_loc = new short[16][4096];
for (int j = 0; j < 4096; j++) { y_loc = new short[16][4096];
final int y = (i4) + (j >> 8); z_loc = new short[16][4096];
final int a = (j - ((y & 0xF) << 8)); for (int i = 0; i < 16; i++) {
final int z1 = (a >> 4); int i4 = i << 4;
final int x1 = a - (z1 << 4); for (int j = 0; j < 4096; j++) {
x_loc[i][j] = (short) x1; final int y = (i4) + (j >> 8);
y_loc[i][j] = (short) y; final int a = (j - ((y & 0xF) << 8));
z_loc[i][j] = (short) z1; final int z1 = (a >> 4);
final int x1 = a - (z1 << 4);
x_loc[i][j] = (short) x1;
y_loc[i][j] = (short) y;
z_loc[i][j] = (short) z1;
}
} }
} }
@ -113,7 +118,6 @@ public class AugmentedPopulator extends BlockPopulator {
@Override @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) {
if (this.plotworld.TERRAIN == 3) { if (this.plotworld.TERRAIN == 3) {
// FIXME check CURRENT_PLOT_CLEAR && FORCE_PASTE
return; return;
} }
final int X = chunk.getX(); final int X = chunk.getX();

View File

@ -76,6 +76,19 @@ public abstract class PlotPopulator extends BlockPopulator {
* @param data * @param data
*/ */
public void setBlock(int x, int y, int z, byte data) { public void setBlock(int x, int y, int z, byte data) {
if (data != 0) {
world.getBlockAt(X + x, y, Z + z).setData(data);
}
}
/**
* Like setblock, but lacks the data != 0 check
* @param x
* @param y
* @param z
* @param data
*/
public void setBlockAbs(int x, int y, int z, byte data) {
world.getBlockAt(X + x, y, Z + z).setData(data); world.getBlockAt(X + x, y, Z + z).setData(data);
} }