update vs

This commit is contained in:
Jesse Boyd 2019-07-11 20:27:29 +10:00
parent 4dea4f4c45
commit b44dcc91b8
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 35 additions and 7 deletions

View File

@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.world.block.BlockID;
import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.SnipeData;
import org.bukkit.Material; import org.bukkit.Material;
@ -11,8 +12,18 @@ public class BlockResetBrush extends Brush {
private static final ArrayList<Material> DENIED_UPDATES = new ArrayList<>(); private static final ArrayList<Material> DENIED_UPDATES = new ArrayList<>();
static { static {
BlockResetBrush.DENIED_UPDATES.add(Material.SIGN); BlockResetBrush.DENIED_UPDATES.add(Material.ACACIA_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.WALL_SIGN); BlockResetBrush.DENIED_UPDATES.add(Material.SPRUCE_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.ACACIA_WALL_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.BIRCH_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.SPRUCE_WALL_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.BIRCH_WALL_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.DARK_OAK_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.DARK_OAK_WALL_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.JUNGLE_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.JUNGLE_WALL_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.OAK_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.OAK_WALL_SIGN);
BlockResetBrush.DENIED_UPDATES.add(Material.CHEST); BlockResetBrush.DENIED_UPDATES.add(Material.CHEST);
BlockResetBrush.DENIED_UPDATES.add(Material.FURNACE); BlockResetBrush.DENIED_UPDATES.add(Material.FURNACE);
BlockResetBrush.DENIED_UPDATES.add(Material.REDSTONE_TORCH); BlockResetBrush.DENIED_UPDATES.add(Material.REDSTONE_TORCH);

View File

@ -11,7 +11,7 @@ import org.bukkit.block.data.BlockData;
*/ */
public class VoxelList { public class VoxelList {
private BlockMask mask = new BlockMask(); private BlockMask mask = new BlockMask(new NullExtent());
/** /**
* Adds the specified id, data value pair to the VoxelList. A data value of -1 will operate on all data values of that id. * Adds the specified id, data value pair to the VoxelList. A data value of -1 will operate on all data values of that id.
@ -19,7 +19,7 @@ public class VoxelList {
* @param i * @param i
*/ */
public void add(BlockState i) { public void add(BlockState i) {
this.mask = mask.toBuilder().add(i).build(NullExtent.INSTANCE); this.mask = mask.add(i);
} }
public void add(BlockMask mask) { public void add(BlockMask mask) {
@ -32,7 +32,7 @@ public class VoxelList {
* @return true if this list contained the specified element * @return true if this list contained the specified element
*/ */
public boolean removeValue(final BlockState state) { public boolean removeValue(final BlockState state) {
this.mask = mask.toBuilder().remove(state).build(NullExtent.INSTANCE); this.mask = mask.remove(state);
return true; return true;
} }
@ -53,7 +53,7 @@ public class VoxelList {
* Clears the VoxelList. * Clears the VoxelList.
*/ */
public void clear() { public void clear() {
mask = mask.toBuilder().clear().build(NullExtent.INSTANCE); mask = mask.clear();
} }
/** /**
@ -62,7 +62,7 @@ public class VoxelList {
* @return true if this list contains no elements * @return true if this list contains no elements
*/ */
public boolean isEmpty() { public boolean isEmpty() {
return mask.toBuilder().isEmpty(); return mask.isEmpty();
} }
/** /**

View File

@ -67,6 +67,23 @@ public class BlockMask extends ABlockMask {
return this; return this;
} }
public BlockMask remove(BlockState... states) {
for (BlockState state : states) ordinals[state.getOrdinal()] = false;
return this;
}
public BlockMask clear() {
Arrays.fill(ordinals, false);
return this;
}
public boolean isEmpty() {
for (boolean value : ordinals) {
if (value) return false;
}
return true;
}
public BlockMask addStates(Collection<BlockState> states) { public BlockMask addStates(Collection<BlockState> states) {
for (BlockState state : states) ordinals[state.getOrdinal()] = true; for (BlockState state : states) ordinals[state.getOrdinal()] = true;
return this; return this;