The bug
Some actions in the game apply the same NBT object instance to multiple items, entities or tile entities. This means if you edit it for one of them you basically edit it for all of them.
This could in theory happen with non-NBT data as well, but at least in the current versions this is not the case because either:
- the data is stored in primitive types and therefor no objects are involved
- the data is provided in NBT format but then parsed and stored with objects; therefor no reference to the NBT data exists anymore
Some of the cases listed below might happen when the NBT data is read or written by entities or tile entities. The expected fix is however not to have them always create a copy because that would slow down saving and loading worlds. Instead the methods calling these methods should create a copy before respectively after.
The reason why this report contains a list of all cases, even the ones which are not affected, is to have an overview and make it easier to detect new cases in which this happens.
Actions
Affected key
Symbol | Meaning |
---|---|
Affected | |
Not affected | |
Currently not affected, but current behavior is listed as bug and therefor likely affected in the future |
List
Based on 1.11.2 decompiled using MCP 9.35 rc1
Last updated for 1.11.2
Likely incomplete
Action | Affected | Comment | Affected method |
---|---|---|---|
Pick block with NBT | Currently happens client-side, but should happen server-side | Minecraft.storeTEInStack(ItemStack, TileEntity) |
|
Copying items in Creative | - | - | |
Crafting: Cloning books | - | - | |
Crafting: Cloning banners | - | - | |
Crafting: Cloning maps | - | RecipesMapCloning.getCraftingResult(InventoryCrafting) |
|
Creating item in Creative with BlockEntityTag | - | NetHandlerPlayServer.processCreativeInventoryAction(CPacketCreativeInventoryAction) |
|
Using item with EntityTag | Dispenser, spawn eggs, armor stand... | ItemMonsterPlacer.applyItemEntityDataToEntity(World, EntityPlayer, ItemStack, Entity) |
|
Item with BlockEntityTag placed | - | - | |
Items from loottables | Uses NBTTagCompound.merge which clones | - | |
Items from villagers | - | - | |
Splitting item stacks | - | - | |
Hopper (minecart) item actions | - | - | |
Droppers transferring items | - | - | |
Cleaning banner in cauldron | - | - | |
Cleaning leather armor in cauldron | Even in Creative stack is replaced and water level reduced, not the case with banners, see MC-114105 | BlockCauldron.onBlockActivated(World, BlockPos, IBlockState, EntityPlayer, EnumHand, EnumFacing, float, float, float) |
|
Putting item on armor stand | - | - | |
Using firework | - | - | |
Putting item in item frame | Only cloned when not empty, but even if empty set as item | EntityItemFrame.setDisplayedItemWithUpdate(ItemStack, boolean) |
|
Putting chest on donkey or mule | Entity does not store item data but only boolean, see |
- | |
Putting saddle on pig | Entity does not store item data but only boolean, see |
- | |
Dispenser / dropper dropping item | - | - | |
Dispenser placing player skull | GameProfile is read and stored | - | |
Dispenser shooting tipped arrow | Potion effects are read and stored | - | |
Dispenser throwing splash or lingering potion | - | - | |
Dispenser equipping armor (including pumpkin, elytra and skull) | - | - | |
Dispenser playing shulker box | - | - | |
/clone | See paragraph "How to reproduce" for reproduction | CommandClone.execute(MinecraftServer, ICommandSender, String[]) |
|
/fill | Fixed, see |
CommandFill.execute(MinecraftServer, ICommandSender, String[]) |
|
/entitydata | Runs for each entity seperately and uses NBTTagCompound.merge which clones | - | |
/replaceitem entity | Runs for each entity seperately | - | |
Structure blocks loading and saving | See |
- |
How to reproduce
Some of these cases cannot be reproduced because other actions only override the affected data instead of modifying it, or other actions create a copy before you could try to reproduce them. Therefor here are only reproduction steps for some actions.
/clone
- Place a spawner
/setblock ~ ~ ~ spawner{SpawnData:{id:"armor_stand"},SpawnCount:0s,SpawnRange:0s,MinSpawnDelay:0s,MaxSpawnDelay:0s,MaxNearbyEntities:1s,RequiredPlayerRange:16s,SpawnPotentials:[{Weight:1,Entity:{id:"bat"}}]}
- Stand on top of the spawner and run the following command
/clone ~ ~-1 ~ ~ ~-1 ~ ~2 ~-1 ~
- For the cloned spawner
- Make it switch to the SpawnPotentials (stand on top of it while running the command)
/data modify block ~ ~-1 ~ SpawnCount set value 1b
- Right click the spawner with a creeper spawn egg
- Make it switch to the SpawnPotentials (stand on top of it while running the command)
- For the original spawner
- Inspect the NBT data
/data get block ~ ~-1 ~ SpawnPotentials
It shows "minecraft:creeper" as entry for the SpawnPotentials instead of "minecraft:bat"
- Inspect the NBT data
/fill
Fixed by MC-163953
- relates to
-
MC-139555 /data modify copies source nbt to destination nbt as reference
- Resolved