Update FaWe #7

Zusammengeführt
Lixfel hat 467 Commits von update nach main 2024-11-28 22:27:32 +01:00 zusammengeführt
3 geänderte Dateien mit 21 neuen und 1 gelöschten Zeilen
Nur Änderungen aus Commit 7281fa360f werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -137,4 +137,9 @@ public class PropertyKey implements Comparable<PropertyKey> {
return Integer.compare(this.id, o.id);
}
@Override
public String toString() {
return "PropertyKey[" + getName() + "]";
}
}

Datei anzeigen

@ -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));
}
}

Datei anzeigen

@ -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()];