Add BlockStateMeta#clearBlockState

This commit is contained in:
Jake Potrebic 2024-01-11 12:41:50 -08:00
parent 23ae9d3c49
commit 1d3be17a60
2 changed files with 14 additions and 0 deletions

View File

@ -239,6 +239,13 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
return this.blockEntityTag != null;
}
// Paper start - add method to clear block state
@Override
public void clearBlockState() {
this.blockEntityTag = null;
}
// Paper end - add method to clear block state
@Override
public BlockState getBlockState() {
return (this.blockEntityTag != null) ? this.blockEntityTag.copy() : CraftMetaBlockState.getBlockState(this.material, null);

View File

@ -257,6 +257,13 @@ public class CraftMetaShield extends CraftMetaItem implements ShieldMeta, BlockS
this.banner = (Banner) blockState;
}
// Paper start - add method to clear block state
@Override
public void clearBlockState() {
this.banner = null;
}
// Paper end - add method to clear block state
private static Banner getBlockState(DyeColor color) {
BlockPos pos = BlockPos.ZERO;
Material stateMaterial = CraftMetaShield.shieldToBannerHack(color);