use of net.modificationstation.stationapi.api.state.property.Property in project StationAPI by ModificationStation.
the class BlockStateHelper method fromBlockState.
public static CompoundTag fromBlockState(BlockState state) {
CompoundTag compoundTag = new CompoundTag();
compoundTag.put("Name", BlockRegistry.INSTANCE.getIdentifier(state.getBlock()).toString());
ImmutableMap<Property<?>, Comparable<?>> immutableMap = state.getEntries();
if (!immutableMap.isEmpty()) {
CompoundTag compoundTag2 = new CompoundTag();
for (Map.Entry<Property<?>, Comparable<?>> propertyComparableEntry : immutableMap.entrySet()) {
Property<?> property = propertyComparableEntry.getKey();
compoundTag2.put(property.getName(), nameValue(property, propertyComparableEntry.getValue()));
}
compoundTag.put("Properties", compoundTag2);
}
return compoundTag;
}
Aggregations