3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-02 17:40:09 +01:00

use full chunks for distr and account for __RESERVED__ blocks

fixes #759
Dieser Commit ist enthalten in:
dordsor21 2020-12-11 16:13:09 +00:00
Ursprung 56cf49c167
Commit ae39f7bba3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
4 geänderte Dateien mit 18 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -40,7 +40,11 @@ public class DistrFilter extends ForkedFilter<DistrFilter> {
@Override @Override
public final void applyBlock(FilterBlock block) { public final void applyBlock(FilterBlock block) {
counter[block.getOrdinal()]++; int ordinal = block.getOrdinal();
if (ordinal == 0) {
ordinal = 1;
}
counter[ordinal]++;
} }
public int getTotal(ABlockMask mask) { public int getTotal(ABlockMask mask) {

Datei anzeigen

@ -178,12 +178,12 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
@Override @Override
public List<Countable<BlockState>> getBlockDistributionWithData(Region region) { public List<Countable<BlockState>> getBlockDistributionWithData(Region region) {
return apply(region, new DistrFilter(), false).getDistribution(); return apply(region, new DistrFilter(), true).getDistribution();
} }
@Override @Override
public List<Countable<BlockType>> getBlockDistribution(Region region) { public List<Countable<BlockType>> getBlockDistribution(Region region) {
return apply(region, new DistrFilter(), false).getTypeDistribution(); return apply(region, new DistrFilter(), true).getTypeDistribution();
} }
/** /**

Datei anzeigen

@ -421,6 +421,10 @@ public interface Extent extends InputExtent, OutputExtent {
for (final BlockVector3 pt : region) { for (final BlockVector3 pt : region) {
BlockType type = getBlock(pt).getBlockType(); BlockType type = getBlock(pt).getBlockType();
if (type == BlockTypes.__RESERVED__) {
counter[1]++;
continue;
}
counter[type.getInternalId()]++; counter[type.getInternalId()]++;
} }
List<Countable<BlockType>> distribution = new ArrayList<>(); List<Countable<BlockType>> distribution = new ArrayList<>();
@ -446,6 +450,13 @@ public interface Extent extends InputExtent, OutputExtent {
for (final BlockVector3 pt : region) { for (final BlockVector3 pt : region) {
BlockState blk = this.getBlock(pt); BlockState blk = this.getBlock(pt);
BlockType type = blk.getBlockType(); BlockType type = blk.getBlockType();
if (type == BlockTypes.__RESERVED__) {
int[] stateCounter = counter[1];
if (stateCounter == null) {
counter[1] = stateCounter = new int[BlockTypes.AIR.getMaxStateId() + 1];
}
stateCounter[BlockTypes.AIR.getDefaultState().getInternalPropertiesId()]++;
}
int[] stateCounter = counter[type.getInternalId()]; int[] stateCounter = counter[type.getInternalId()];
if (stateCounter == null) { if (stateCounter == null) {
counter[type.getInternalId()] = stateCounter = new int[type.getMaxStateId() + 1]; counter[type.getInternalId()] = stateCounter = new int[type.getMaxStateId() + 1];

Datei anzeigen

@ -22,7 +22,6 @@ import com.sk89q.worldedit.world.block.BlockType;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class PassthroughExtent extends AbstractDelegateExtent { public class PassthroughExtent extends AbstractDelegateExtent {