Allow editing air items
HyperSoop opened this issue ยท 4 comments
It makes little to no sence to prohibit editing air with /nbt. It's an item like any other, and can be made into another item through the Item ID field.
Air is a bit of an outlier - it can be represented by ItemStack.EMPTY
or simply null
(null is the absence of an item), depending on what part of Minecraft you ask. It also can't really have nbt.
That's actually what inspired the /get
command, and is the intended way to create new items.
In fact, the ability to convert an item into air via the Item ID field was unintended, and could lead to 'nbt loss' for that item, if you don't convert it back - I should probably add in a warning when saving an air item.
Considering allowing /nbt on an empty slot would be different behavior compared to all the other commands, do you think I should:
- Add a config option to allow /nbt on air
- Allow /nbt on air (no config)
- Don't change anything
Air is a bit of an outlier - it can be represented by
ItemStack.EMPTY
or simplynull
(null is the absence of an item), depending on what part of Minecraft you ask. It also can't really have nbt. That's actually what inspired the/get
command, and is the intended way to create new items. In fact, the ability to convert an item into air via the Item ID field was unintended, and could lead to 'nbt loss' for that item, if you don't convert it back - I should probably add in a warning when saving an air item.Considering allowing /nbt on an empty slot would be different behavior compared to all the other commands, do you think I should:
* Add a config option to allow /nbt on air * Allow /nbt on air (no config) * Don't change anything
I think there could be a config option for this, enabled by default.
Yesterday I started to implement this, but I ran into some glitches.
While I believe I have everything fixed, working with air is always going to be a bit dangerous.
So here's what I ended up deciding to do:
- I created a new sub-command
/nbt new <item>
, which is the equivalent of/nbt
followed by changing the type - I added an experimental config option for editing air, which:
- When enabled:
/nbt
with both hands empty will edit air in the main hand- Space on an empty slot will open the editor (keybind hints aren't shown)
- Saving air with nbt will have a warning about nbt loss
- When disabled: Changing an item to air via the item id field is now removed
- When enabled:
Hopefully that is a good compromise!
The update should be out very soon.