oh right block states are immutable

This commit is contained in:
Meredith Espinosa 2019-06-18 23:03:32 -07:00
parent e58edda102
commit 07abe31ea4

View File

@ -18,7 +18,7 @@ public class BlockStateUtil {
BlockState state = factory.getDefaultState(); BlockState state = factory.getDefaultState();
for (String key : properties.getKeys()) { for (String key : properties.getKeys()) {
Property<?> prop = factory.getProperty(key); Property<?> prop = factory.getProperty(key);
if (prop != null) parseProperty(state, prop, properties.getString(key)); if (prop != null) state = parseProperty(state, prop, properties.getString(key));
} }
return state; return state;
} }
@ -34,13 +34,11 @@ public class BlockStateUtil {
return tag; return tag;
} }
public static <T extends Comparable<T>> void parseProperty(BlockState state, Property<T> property, String value) { public static <T extends Comparable<T>> BlockState parseProperty(BlockState state, Property<T> property, String value) {
System.out.println(value);
Optional<T> optional = property.getValue(value); Optional<T> optional = property.getValue(value);
if (optional.isPresent()) { if (optional.isPresent()) {
System.out.println(optional.get()); state = state.with(property, optional.get());
state.with(property, optional.get());
System.out.println(state.get(property));
} }
return state;
} }
} }