Make BlockType#getDefaultState like other fields

This commit is contained in:
Kenzie Togami 2018-10-04 17:20:07 -07:00
parent ef2c07ca24
commit ff877ec03b
No known key found for this signature in database
GPG Key ID: 5D200B325E157A81

View File

@ -86,16 +86,6 @@ public class BlockType {
return updateField(blockStatesMap, () -> BlockState.generateStateMap(this));
}
private BlockState getDefaultStateMemoized() {
return updateField(defaultState, () -> {
BlockState defaultState = new ArrayList<>(getBlockStatesMap().values()).get(0);
if (values != null) {
defaultState = values.apply(defaultState);
}
return defaultState;
});
}
/**
* Gets the ID of this block.
*
@ -156,7 +146,13 @@ public class BlockType {
* @return The default state
*/
public BlockState getDefaultState() {
return getDefaultStateMemoized();
return updateField(defaultState, () -> {
BlockState defaultState = new ArrayList<>(getBlockStatesMap().values()).get(0);
if (values != null) {
defaultState = values.apply(defaultState);
}
return defaultState;
});
}
/**