concurrency issue w/ data not being cleared

This commit is contained in:
Jesse Boyd 2017-03-28 13:04:36 +11:00
parent 8afcc054f0
commit 11327d49e1
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 14 additions and 11 deletions

View File

@ -121,11 +121,8 @@ public class HeightMapMCAGenerator implements Extent {
return true;
}
public int count;
@Override
public boolean setBlock(int x, int y, int z, BaseBlock block) throws WorldEditException {
count++;
int index = z * width + x;
if (index < 0 || index >= heights.length) return false;
int height = heights[index] & 0xFF;
@ -733,9 +730,14 @@ public class HeightMapMCAGenerator implements Extent {
try {
MCAChunk chunk = chunkStore.get();
int[] indexes = indexStore.get();
for (byte[] array : chunk.ids) {
if (array != null) {
Arrays.fill(array, (byte) 0);
for (int i = 0; i < chunk.ids.length; i++) {
byte[] idsArray = chunk.ids[i];
if (idsArray != null) {
Arrays.fill(idsArray, (byte) 0);
}
byte[] dataArray = chunk.data[i];
if (dataArray != null) {
Arrays.fill(dataArray, (byte) 0);
}
}
int index = 0;
@ -859,6 +861,7 @@ public class HeightMapMCAGenerator implements Extent {
int maxYMod = 15 + (maxLayer << 4);
for (int layer = (maxY >> 4) + 1; layer < 16; layer++) {
chunk.ids[layer] = null;
chunk.data[layer] = null;
}
index = 0;
{ // Bedrock

View File

@ -175,11 +175,11 @@ public interface Extent extends InputExtent, OutputExtent {
}
default public void addOres(Region region, Mask mask) throws WorldEditException {
addOre(region, mask, new BlockPattern(BlockID.DIRT), 30, 4, 100, 0, 255);
addOre(region, mask, new BlockPattern(BlockID.GRAVEL), 30, 2, 100, 0, 255);
addOre(region, mask, new BlockPattern(BlockID.STONE, 1), 30, 4, 100, 0, 79);
addOre(region, mask, new BlockPattern(BlockID.STONE, 3), 30, 4, 100, 0, 79);
addOre(region, mask, new BlockPattern(BlockID.STONE, 5), 30, 4, 100, 0, 79);
addOre(region, mask, new BlockPattern(BlockID.DIRT), 33, 10, 100, 0, 255);
addOre(region, mask, new BlockPattern(BlockID.GRAVEL), 33, 8, 100, 0, 255);
addOre(region, mask, new BlockPattern(BlockID.STONE, 1), 33, 10, 100, 0, 79);
addOre(region, mask, new BlockPattern(BlockID.STONE, 3), 33, 10, 100, 0, 79);
addOre(region, mask, new BlockPattern(BlockID.STONE, 5), 33, 10, 100, 0, 79);
addOre(region, mask, new BlockPattern(BlockID.COAL_ORE), 17, 20, 100, 0, 127);
addOre(region, mask, new BlockPattern(BlockID.IRON_ORE), 9, 20, 100, 0, 63);
addOre(region, mask, new BlockPattern(BlockID.GOLD_ORE), 9, 2, 100, 0, 31);