-
Bug
-
Resolution: Invalid
-
None
-
1.20.2, 23w46a
-
None
-
Unconfirmed
-
(Unassigned)
public static final ItemStack EMPTY = new ItemStack((Void)null);
This EMPTY cause some problem. First - programmer or modder dont know that instance is "EMPTY", if no check. Than he can set nbt to EMPTY item.
And it cause some bug:
Select item with nbt. Drop item. run in java System.out.println(Minecraft.getInstance().player.getMainHandItem().save(new CompoundTag()));
Expect -
Got - {id:"minecraft:air",Count:1b,tag:{...}}
How to fix it?
replace EMPTY = new ItemStack((Void)null); to
new ItemStack((Void)null) {
public void setTag(@Nullable CompoundTag compoundTag) {}
public CompoundTag getOrCreateTag()
public CompoundTag save(CompoundTag compoundTag)
{compoundTag.putString("id","minecraft:air");compoundTag.putByte("Count",(byte)1)}}
It will help modding and Mojang.