Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-07 00:22:51 +02: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
|
||||
public boolean test(Vector 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
|
||||
|
@ -53,4 +53,17 @@ public abstract class AbstractProperty<T> implements Property<T> {
|
||||
checkState(this.name == null, "name already set");
|
||||
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.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -167,7 +170,7 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Property> differingProperties = new ArrayList<>();
|
||||
Set<Property> differingProperties = new HashSet<>();
|
||||
for (Object state : o.getStates().keySet()) {
|
||||
if (getState((Property) state) == null) {
|
||||
differingProperties.add((Property) state);
|
||||
@ -179,8 +182,11 @@ public class BlockState implements BlockStateHolder<BlockState> {
|
||||
}
|
||||
}
|
||||
|
||||
for (Property property : differingProperties) {
|
||||
if (!getState(property).equals(o.getState(property))) {
|
||||
for (Property property : getStates().keySet()) {
|
||||
if (differingProperties.contains(property)) {
|
||||
continue;
|
||||
}
|
||||
if (!Objects.equals(getState(property), o.getState(property))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren