Permalink
Browse files

Make BlockType#getDefaultState like other fields

  • Loading branch information...
kenzierocks committed Oct 5, 2018
1 parent ef2c07c commit ff877ec03b8cb3fd19b532be56ab4a6152bfa8fd
Showing with 7 additions and 11 deletions.
  1. +7 −11 worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java
@@ -86,16 +86,6 @@ public BlockType(String id, Function<BlockState, BlockState> values) {
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 String getName() {
* @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;
});
}
/**

0 comments on commit ff877ec

Please sign in to comment.