use of net.minecraft.state.BooleanProperty in project Bookshelf by Darkhax-Minecraft.
the class SerializerBlockState method write.
@Override
public JsonElement write(BlockState toWrite) {
final JsonObject json = new JsonObject();
json.add("block", Serializers.BLOCK.write(toWrite.getBlock()));
final JsonObject properties = new JsonObject();
for (final Property prop : toWrite.getProperties()) {
if (prop instanceof IntegerProperty) {
properties.addProperty(prop.getName(), (int) toWrite.getValue((IntegerProperty) prop));
} else if (prop instanceof BooleanProperty) {
properties.addProperty(prop.getName(), (boolean) toWrite.getValue((BooleanProperty) prop));
} else {
properties.addProperty(prop.getName(), prop.getName(toWrite.getValue(prop)));
}
}
json.add("properties", properties);
return json;
}
Aggregations