Make BlockDataMeta#setBlockData hide unspecified states
This commit is contained in:
parent
dd08a71208
commit
e9447dc5e5
@ -253,10 +253,14 @@ public class CraftBlockData implements BlockData {
|
|||||||
return stateString.toString();
|
return stateString.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> toStates() {
|
public Map<String, String> toStates(boolean hideUnspecified) {
|
||||||
|
return (hideUnspecified && parsedStates != null) ? toStates(parsedStates) : toStates(state.getValues());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, String> toStates(Map<IBlockState<?>, Comparable<?>> states) {
|
||||||
Map<String, String> compound = new HashMap<>();
|
Map<String, String> compound = new HashMap<>();
|
||||||
|
|
||||||
for (Map.Entry<IBlockState<?>, Comparable<?>> entry : state.getValues().entrySet()) {
|
for (Map.Entry<IBlockState<?>, Comparable<?>> entry : states.entrySet()) {
|
||||||
IBlockState iblockstate = (IBlockState) entry.getKey();
|
IBlockState iblockstate = (IBlockState) entry.getKey();
|
||||||
|
|
||||||
compound.put(iblockstate.getName(), iblockstate.getName(entry.getValue()));
|
compound.put(iblockstate.getName(), iblockstate.getName(entry.getValue()));
|
||||||
|
@ -1318,7 +1318,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockData(BlockData blockData) {
|
public void setBlockData(BlockData blockData) {
|
||||||
this.blockData = (blockData == null) ? null : ((CraftBlockData) blockData).toStates();
|
this.blockData = (blockData == null) ? null : ((CraftBlockData) blockData).toStates(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user