Plenty of changes to core block behavior to become more compatible with upstream WorldEdit (still more to be done!)

This commit is contained in:
IronApollo
2019-01-31 10:08:58 -05:00
parent 271b45f3ba
commit e53535319d
116 changed files with 3666 additions and 3774 deletions

View File

@ -62,7 +62,7 @@ public class BlockMask extends AbstractExtentMask {
for (int i = 0; i < bitSets.length; i++) {
if (bitSets[i] != null) {
long[] set = bitSets[i];
BlockTypes type = BlockTypes.get(i);
BlockType type = BlockTypes.get(i);
if (set == ALL) {
strings.add(type.getId());
} else {
@ -137,7 +137,7 @@ public class BlockMask extends AbstractExtentMask {
boolean single = true;
int and = type.getInternalId();
List<? extends Property> properties = type.getProperties();
for (AbstractProperty prop : (List<AbstractProperty>) type.getProperties()) {
for (AbstractProperty prop : (List<AbstractProperty<?>>) type.getProperties()) {
List values = prop.getValues();
int numSet = 0;
for (int i = 0; i < values.size(); i++) {

View File

@ -90,15 +90,15 @@ public class BlockMaskBuilder {
charSequence.setString(input);
charSequence.setSubstring(0, propStart);
BlockTypes type = null;
List<BlockTypes> blockTypeList = null;
BlockType type = null;
List<BlockType> blockTypeList = null;
if (StringMan.isAlphanumericUnd(charSequence)) {
type = BlockTypes.parse(charSequence.toString());
add(type);
} else {
String regex = charSequence.toString();
blockTypeList = new ArrayList<>();
for (BlockTypes myType : BlockTypes.values) {
for (BlockType myType : BlockTypes.values) {
if (myType.getId().matches(regex)) {
blockTypeList.add(myType);
add(myType);
@ -135,14 +135,14 @@ public class BlockMaskBuilder {
filtered = filterRegexOrOperator(type, key, operator, charSequence);
}
else {
for (BlockTypes myType : blockTypeList) {
for (BlockType myType : blockTypeList) {
filtered |= filterRegexOrOperator(myType, key, operator, charSequence);
}
}
if (!filtered) {
String value = charSequence.toString();
final PropertyKey fKey = key;
Collection<BlockTypes> types = type != null ? Collections.singleton(type) : blockTypeList;
Collection<BlockType> types = type != null ? Collections.singleton(type) : blockTypeList;
throw new SuggestInputParseException("No value for " + input, input, () -> {
HashSet<String> values = new HashSet<>();
types.forEach(t -> {
@ -206,7 +206,7 @@ public class BlockMaskBuilder {
if (StringMan.isAlphanumericUnd(input)) {
add(BlockTypes.parse(input));
} else {
for (BlockTypes myType : BlockTypes.values) {
for (BlockType myType : BlockTypes.values) {
if (myType.getId().matches(input)) {
add(myType);
}
@ -225,7 +225,7 @@ public class BlockMaskBuilder {
return (states == BlockMask.ALL || FastBitSet.get(states, localI));
}
private void suggest(String input, String property, Collection<BlockTypes> finalTypes) throws InputParseException {
private void suggest(String input, String property, Collection<BlockType> finalTypes) throws InputParseException {
throw new SuggestInputParseException(input + " does not have: " + property, input, () -> {
Set<PropertyKey> keys = new HashSet<>();
finalTypes.forEach(t -> t.getProperties().stream().forEach(p -> keys.add(p.getKey())));
@ -346,7 +346,7 @@ public class BlockMaskBuilder {
bitSets[i] = null;
continue;
}
List<AbstractProperty> properties = (List<AbstractProperty>) type.getProperties();
List<AbstractProperty<?>> properties = (List<AbstractProperty<?>>) type.getProperties();
for (AbstractProperty prop : properties) {
List values = prop.getValues();
for (int j = 0; j < values.size(); j++) {
@ -425,7 +425,7 @@ public class BlockMaskBuilder {
if (!typePredicate.test(type)) {
continue;
}
for (AbstractProperty prop : (List<AbstractProperty>) type.getProperties()) {
for (AbstractProperty prop : (List<AbstractProperty<?>>) type.getProperties()) {
List values = prop.getValues();
for (int j = 0; j < values.size(); j++) {
int localI = j << prop.getBitOffset() >> BlockTypes.BIT_OFFSET;
@ -533,7 +533,7 @@ public class BlockMaskBuilder {
}
int set = 0;
int clear = 0;
for (AbstractProperty prop : (List<AbstractProperty>) type.getProperties()) {
for (AbstractProperty prop : (List<AbstractProperty<?>>) type.getProperties()) {
List values = prop.getValues();
for (int j = 0; j < values.size(); j++) {
int localI = j << prop.getBitOffset() >> BlockTypes.BIT_OFFSET;

View File

@ -4,7 +4,7 @@ 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.blocks.BlockType;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -14,7 +14,7 @@ public class SolidBlockMask extends BlockTypeMask {
public static boolean[] getTypes() {
boolean[] types = new boolean[BlockTypes.size()];
for (BlockTypes type : BlockTypes.values) {
for (BlockType type : BlockTypes.values) {
types[type.getInternalId()] = type.getMaterial().isSolid();
}
return types;

View File

@ -90,13 +90,8 @@ public class ForwardExtentCopy implements Operation {
* @param source the source extent
* @param region the region to copy
* @param destination the destination extent
<<<<<<< HEAD
* @param to the destination position
* @see #ForwardExtentCopy(Extent, Region, Vector, Extent, Vector) the main constructor
=======
* @param to the destination position
* @see #ForwardExtentCopy(Extent, Region, BlockVector3, Extent, BlockVector3) the main constructor
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
*/
public ForwardExtentCopy(Extent source, Region region, Extent destination, BlockVector3 to) {
this(source, region, region.getMinimumPoint(), destination, to);