Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 02:50:05 +01:00
Bunch of changes to help masks
Dieser Commit ist enthalten in:
Ursprung
18c9da372c
Commit
f1d4104480
@ -609,6 +609,10 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
||||
} else {
|
||||
ordinal = adapter.adaptToChar(ibd);
|
||||
}
|
||||
// Don't read "empty".
|
||||
if (ordinal == 0) {
|
||||
ordinal = 1;
|
||||
}
|
||||
paletteToBlockChars[paletteVal] = ordinal;
|
||||
}
|
||||
data[i] = ordinal;
|
||||
@ -636,10 +640,18 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
||||
val = ordinal(palette.a(i), adapter);
|
||||
paletteToOrdinal[i] = val;
|
||||
}
|
||||
// Don't read "empty".
|
||||
if (val == 0) {
|
||||
val = 1;
|
||||
}
|
||||
data[i] = val;
|
||||
}
|
||||
} else {
|
||||
char ordinal = ordinal(palette.a(0), adapter);
|
||||
// Don't read "empty".
|
||||
if (ordinal == 0) {
|
||||
ordinal = 1;
|
||||
}
|
||||
Arrays.fill(data, ordinal);
|
||||
}
|
||||
} finally {
|
||||
|
@ -629,6 +629,10 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
||||
}
|
||||
paletteToBlockChars[paletteVal] = ordinal;
|
||||
}
|
||||
// Don't read "empty".
|
||||
if (ordinal == 0) {
|
||||
ordinal = 1;
|
||||
}
|
||||
data[i] = ordinal;
|
||||
}
|
||||
} finally {
|
||||
@ -654,10 +658,18 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
||||
val = ordinal(palette.a(i), adapter);
|
||||
paletteToOrdinal[i] = val;
|
||||
}
|
||||
// Don't read "empty".
|
||||
if (val == 0) {
|
||||
val = 1;
|
||||
}
|
||||
data[i] = val;
|
||||
}
|
||||
} else {
|
||||
char ordinal = ordinal(palette.a(0), adapter);
|
||||
// Don't read "empty".
|
||||
if (ordinal == 0) {
|
||||
ordinal = 1;
|
||||
}
|
||||
Arrays.fill(data, ordinal);
|
||||
}
|
||||
} finally {
|
||||
|
@ -600,6 +600,10 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
||||
}
|
||||
paletteToBlockChars[paletteVal] = ordinal;
|
||||
}
|
||||
// Don't read "empty".
|
||||
if (ordinal == 0) {
|
||||
ordinal = 1;
|
||||
}
|
||||
data[i] = ordinal;
|
||||
}
|
||||
} finally {
|
||||
@ -625,10 +629,18 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
||||
val = ordinal(palette.a(i), adapter);
|
||||
paletteToOrdinal[i] = val;
|
||||
}
|
||||
// Don't read "empty".
|
||||
if (val == 0) {
|
||||
val = 1;
|
||||
}
|
||||
data[i] = val;
|
||||
}
|
||||
} else {
|
||||
char ordinal = ordinal(palette.a(0), adapter);
|
||||
// Don't read "empty".
|
||||
if (ordinal == 0) {
|
||||
ordinal = 1;
|
||||
}
|
||||
Arrays.fill(data, ordinal);
|
||||
}
|
||||
} finally {
|
||||
|
@ -27,7 +27,7 @@ public abstract class CharGetBlocks extends CharBlocks implements IChunkGet {
|
||||
|
||||
public char[] update(int layer, char[] data) {
|
||||
if (data == null) {
|
||||
return new char[4096];
|
||||
data = new char[4096];
|
||||
}
|
||||
Arrays.fill(data, (char) 1);
|
||||
return data;
|
||||
|
@ -184,7 +184,7 @@ public class BlockMask extends ABlockMask {
|
||||
}
|
||||
@Override
|
||||
public boolean test(BlockState state) {
|
||||
return ordinals[state.getOrdinal()];
|
||||
return ordinals[state.getOrdinal()] || replacesAir() && state.getOrdinal() <= 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,10 +3,10 @@ package com.sk89q.worldedit.function.mask;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
public class InverseSingleBlockStateMask extends ABlockMask {
|
||||
private final char ordinal;
|
||||
private final boolean isAir;
|
||||
|
||||
public BlockState getBlockState() {
|
||||
return BlockState.getFromOrdinal(ordinal);
|
||||
@ -14,17 +14,26 @@ public class InverseSingleBlockStateMask extends ABlockMask {
|
||||
|
||||
public InverseSingleBlockStateMask(Extent extent, BlockState state) {
|
||||
super(extent);
|
||||
isAir = state.isAir();
|
||||
this.ordinal = state.getOrdinalChar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return ordinal != vector.getOrdinal(extent);
|
||||
int test = vector.getOrdinal(extent);
|
||||
if (isAir && test == 0) {
|
||||
return false;
|
||||
}
|
||||
return ordinal != test;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean test(BlockState state) {
|
||||
return state.getOrdinalChar() != ordinal;
|
||||
int test = state.getOrdinalChar();
|
||||
if (isAir && test == 0) {
|
||||
return false;
|
||||
}
|
||||
return test != ordinal;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,7 +13,7 @@ public class SingleBlockTypeMask extends ABlockMask {
|
||||
public SingleBlockTypeMask(Extent extent, BlockType type) {
|
||||
super(extent);
|
||||
isAir = type == BlockTypes.AIR || type == BlockTypes.CAVE_AIR || type == BlockTypes.VOID_AIR;
|
||||
this.internalId = type.getInternalId();
|
||||
this.internalId = type.getInternalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren