Affects 1.16.3 with entities that have a width of 1.0 (and possibly larger)
Still happening in 1.12.0
Might be fixed in 1.12 now, needs testing "Removing a timer component and adding a new one should no longer have the new timer inherit the old timer's time value"
Still affects 1.11.4 Release
Thought my behavior pack was bugged, but found this for the first google result, my map needs dodaylightcycle to be false unfortunately.
Updating to say this is still unresolved in 1.10 and breaking balance of some marketplace maps.
Found out how to fix this in vanilla code I think. Encountered the bug reliably with my own entity using forge, upon debugging I tracked it down and tested a fix, works consistently for me. Heres my notes based on MCP mappings:
So vanilla behavior works like this:
Actively leashed entity EntityLiving.leashedToEntity is written to nbt with tag "Leash" when chunk unloads.
On chunk reload, the nbt data is loaded into a temporary variable called EntityLiving.leashNBTTag
The next time the entity ticks, it detects EntityLiving.leashNBTTag has data and attempts to re-establish the leash link and set EntityLiving.leashedToEntity
An important note here is that EntityLiving.leashNBTTag is not written to disk, it only writes to the "Leash" nbt tag if EntityLiving.leashedToEntity is not null.
So heres the real bug: There is an edge case where the entity can load and then instantly unload before it has a chance to tick, causing the data loaded into EntityLiving.leashNBTTag, but then never properly used to set EntityLiving.leashedToEntity, since EntityLiving.leashNBTTag is not serialized, the leashed data is now lost forever, breaking the leash link.
Heres the fix: In EntityLiving.writeEntityToNBT, at the end of the "if (this.leashedToEntity != null) {" if statement, add an else clause:
} else if (leashNBTTag != null) {
compound.setTag("Leash", leashNBTTag);
}
This makes sure the leashNBTTag data is preseved if it wasnt able to get made use of.
Note I only confirmed this fix with my own entity that reproduces it a lot, did this test fix in vanilla code and confirmed it fixes it, tested with my entity leashed to a fence post only, not to another entity eg the player, which probably doesn't have the bug since theyre always chunkloaded.
Also note, you will still get visibly broken leash links on the client side, but server side the link is still there.
Same issues here, from my report:
When clearing a players inventory of a certain item then giving another item, the first item does not show up until you force a manual update of the slot by trying to place something in the "empty" slot that actually has an item, but only if they didn't have the item to begin with. Slot count will remain 1 behind if you don't force an update.
Steps to reproduce:
1. Run "clear" command on yourself to make sure inventory state reset
2. Give yourself a stack of gold_nugget items
3. Place down a command block in impulse/need redstone mode, give it the command: "clear @p gold_nugget -1 2"
4. Place down a command block with the first one pointing to it, put it in chain/conditional/always active mode, give it the command: "give @p spawn_egg 1 17"
5. Put a button on the impulse command block, press it.
Wether you are in creative or adventure mode, it should have taken 2 gold nuggets off you and given you a ghosted invisible spawn egg in the next logical inventory spot.
You can confirm this by splitting the gold nugget stack and trying to place it where you would have expected the spawn egg to be, the game will then realize the issue and cancel the placement and actually show the spawn egg.
Alternatively, you could just press the button a second time, and you will see you finally have 1 spawn egg, but its actually 2, select the spawn egg, press q to toss them, it'll cancel that action and show 2 spawn eggs now.
After forcing a manual update, the problem appears to go away until you no longer have any of that item or have cleared your inventory.
This is the only scenario I have found this issue, but also the only easy way I can trade 1 item for another as a form of currency so its a fairly major bug for what I need.
Edit: appears to be mostly related to chain command blocks and use of clear command or maybe just multiple inventory based commands, if you replace the command from step 4 with "/enchant @p sharpness 3" and have a sword, the same type of issue happens, your sword doesnt appear enchanted until you try to move it in your inventory.
Edit 2: the result message is also very weird for this type of clear command, despite filtering it for just a specific item for a specific count it will say stuff like "Cleared the inventory of NAME, removing 12 items", 12 items being the total count of everything I have, the code logic of the clear command probably needs a good cleanup.
Same issue here, was very confused and glad I found this post. q.heightmap doesnt work either.