mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-19 14:51:27 +01:00
Make BlockDataMeta#setBlockData hide unspecified states
By: md_5 <git@md-5.net>
This commit is contained in:
parent
8f7a88cc91
commit
0f66e39e46
@ -253,10 +253,14 @@ public class CraftBlockData implements BlockData {
|
||||
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<>();
|
||||
|
||||
for (Map.Entry<IBlockState<?>, Comparable<?>> entry : state.getValues().entrySet()) {
|
||||
for (Map.Entry<IBlockState<?>, Comparable<?>> entry : states.entrySet()) {
|
||||
IBlockState iblockstate = (IBlockState) entry.getKey();
|
||||
|
||||
compound.put(iblockstate.getName(), iblockstate.getName(entry.getValue()));
|
||||
|
@ -1318,7 +1318,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
||||
@Override
|
||||
public void setBlockData(BlockData blockData) {
|
||||
this.blockData = (blockData == null) ? null : ((CraftBlockData) blockData).toStates();
|
||||
this.blockData = (blockData == null) ? null : ((CraftBlockData) blockData).toStates(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user