geforkt von Mirrors/FastAsyncWorldEdit
Update FaWe #7
@ -137,4 +137,9 @@ public class PropertyKey implements Comparable<PropertyKey> {
|
||||
return Integer.compare(this.id, o.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PropertyKey[" + getName() + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
||||
BlockState newState = this;
|
||||
for (Property<?> prop : ot.getProperties()) {
|
||||
PropertyKey key = prop.getKey();
|
||||
if (blockType.hasProperty(key)) {
|
||||
if (blockType.hasPropertyOfType(key, prop.getClass())) {
|
||||
newState = newState.with(key, other.getState(key));
|
||||
}
|
||||
}
|
||||
|
@ -247,6 +247,21 @@ public class BlockType implements Keyed, Pattern {
|
||||
return this.settings.propertiesMapArr.length > ordinal && this.settings.propertiesMapArr[ordinal] != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return whether this block type has a property with given key of the given type}
|
||||
*
|
||||
* @param key the key identifying the property
|
||||
* @param propertyType the expected type of the property
|
||||
* @since TODO
|
||||
*/
|
||||
public boolean hasPropertyOfType(PropertyKey key, Class<?> propertyType) {
|
||||
int ordinal = key.getId();
|
||||
Property<?> property;
|
||||
return this.settings.propertiesMapArr.length > ordinal
|
||||
&& (property = this.settings.propertiesMapArr[ordinal]) != null
|
||||
&& property.getClass() == propertyType;
|
||||
}
|
||||
|
||||
public <V> Property<V> getProperty(PropertyKey key) {
|
||||
try {
|
||||
return (Property<V>) this.settings.propertiesMapArr[key.getId()];
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren