Topic category: Help with Minecraft modding (Java Edition)
There are two procedures here:
According to the idea, if a custom creature kills a player, it takes all the items in player's inventory into it's inventory(1img)(The size of the entity's inventory is 100 slots). Then, when the player kills the entity, all the stolen items will drop(2img).
But in practice, if an entity dies(after killing a player with a full inventory), it drops a stack of items from only one random player slot. After a dozen tests, I still did not understand the logic of this behavior and what the problem is: in the procedure of copying the player's inventory or in the procedure of dropping items.
I also ran a test with copying the player's inventory into the spawning chest, and it worked fine with the block's inventory(except that I had to make sure that no more than 27 slots would be occupied.), but I still don't know why the problem with the entity's is happening.
Translated