mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 08:17:44 +01:00
SPIGOT-7376: Exception with getBlockData when hasBlockData is false
By: md_5 <git@md-5.net>
This commit is contained in:
parent
99be5d2a3c
commit
f990d547f7
@ -45,6 +45,7 @@ import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.network.chat.IChatBaseComponent;
|
||||
import net.minecraft.world.entity.EnumItemSlot;
|
||||
import net.minecraft.world.item.ItemBlock;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import org.bukkit.Material;
|
||||
@ -911,12 +912,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
||||
@Override
|
||||
public boolean hasBlockData() {
|
||||
return this.blockData != null;
|
||||
return this.blockData != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData getBlockData(Material material) {
|
||||
return CraftBlockData.fromData(ItemBlock.getBlockState(CraftMagicNumbers.getBlock(material).defaultBlockState(), blockData));
|
||||
IBlockData defaultData = CraftMagicNumbers.getBlock(material).defaultBlockState();
|
||||
return CraftBlockData.fromData((hasBlockData()) ? ItemBlock.getBlockState(defaultData, blockData) : defaultData);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user