Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 20:10:06 +01:00
Fixed //replace and masks with states.
Dieser Commit ist enthalten in:
Ursprung
663dd1f4d8
Commit
2239d14a01
@ -95,7 +95,13 @@ public class BlockMask extends AbstractExtentMask {
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(Vector vector) {
|
public boolean test(Vector vector) {
|
||||||
BlockStateHolder block = getExtent().getBlock(vector);
|
BlockStateHolder block = getExtent().getBlock(vector);
|
||||||
return blocks.contains(block) || blocks.contains(block);
|
for (BlockStateHolder testBlock : blocks) {
|
||||||
|
if (testBlock.equalsFuzzy(block)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -53,4 +53,17 @@ public abstract class AbstractProperty<T> implements Property<T> {
|
|||||||
checkState(this.name == null, "name already set");
|
checkState(this.name == null, "name already set");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return name.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (!(obj instanceof Property)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getName().equals(((Property) obj).getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,7 +170,7 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Property> differingProperties = new ArrayList<>();
|
Set<Property> differingProperties = new HashSet<>();
|
||||||
for (Object state : o.getStates().keySet()) {
|
for (Object state : o.getStates().keySet()) {
|
||||||
if (getState((Property) state) == null) {
|
if (getState((Property) state) == null) {
|
||||||
differingProperties.add((Property) state);
|
differingProperties.add((Property) state);
|
||||||
@ -179,8 +182,11 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Property property : differingProperties) {
|
for (Property property : getStates().keySet()) {
|
||||||
if (!getState(property).equals(o.getState(property))) {
|
if (differingProperties.contains(property)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(getState(property), o.getState(property))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren