mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Bunch of changes to help masks
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user