Picking up an incomplete stack of items is not correctly detected
The bug
Picking up only a part of an item stack of an item entity because your inventory is nearly full is not correctly detected by the server causing:
- Server-side:
- Missing statistics change
- Client-side:
- Missing sound and animation
- Item stack of item entity not updated
How to reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Fill all of your inventory except for the first hotbar slot with one item (e.g. wooden swords), fill the hotbar slot with a nearly full stack of for example stone
/give @s wooden_sword 36 /item replace entity @s hotbar.0 with minecraft:stone 63
- Switch to survival mode (This is needed because in creative you can pick items up even when the inventory is full.)
/gamemode survival
- Summon an item entity containing two stone items
/summon item ~ ~ ~ {Item:{id:"stone",Count:2b}}→
The item entity still shows two items, there was no sound, no animation, etc.
Code analysis
Based on 1.12.2 decompiled using MCP 9.40
The method net.minecraft.entity.item.EntityItem.onCollideWithPlayer(EntityPlayer) tests if net.minecraft.entity.player.InventoryPlayer.addItemStackToInventory(ItemStack) returns true. Since this is only the case if the complete stack was picked up, it should instead test if the stack size decreased.
The following shows the problems with the current code:
ItemStack itemstack = this.getItem(); Item item = itemstack.getItem(); int i = itemstack.getCount(); // Don't test for entityIn.inventory.addItemStackToInventory(itemstack) == true if (this.pickupDelay == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) { // Change this, picked up count can be < i entityIn.onItemPickup(this, i); if (itemstack.isEmpty()) { this.setDead(); itemstack.setCount(i); } // Change this, picked up count can be < i entityIn.addStat(StatList.getObjectsPickedUpStats(item), i); }
Linked Issues
discovered while testing1
is duplicated by11
- Unresolved
[Mod] Pokechu22- 24
- 13
- Confirmed
Normal
- Platform
- Networking
- animation item item-entity item-pickup sound statistics
1.12.1 - 1.21
1.12.1 1.12.2-pre1 1.12.2-pre2 1.12.2 17w43a 17w43b 17w45a 17w45b 17w46a 17w48a 17w50a 18w01a 18w03b 18w06a 18w07b 18w09a 18w10d 18w14b 1.13-pre1 1.13-pre3 1.13-pre6 1.13-pre10 1.13 18w30b 18w31a 1.13.1 1.13.2 19w04b 19w05a 19w06a 1.14.4 1.15-pre6 1.15.1 20w21a 1.16-pre4 1.16-pre6 1.16 1.16.4 20w48a 20w51a 1.16.5 21w05b 1.17 1.17.1-pre1 1.17.1-pre2 1.17.1 21w41a 21w42a 21w43a 21w44a 1.18-pre1 1.18-pre4 1.18-pre5 1.18-pre6 1.18-pre8 1.18-rc1 1.18-rc3 1.18.1 1.19 1.19.1 1.19.3 23w05a 1.19.4 1.20.1 1.20.6 24w19b 1.21
Created Issue:
Picking up an incomplete stack of items doesn't visually update the stack left on the ground
When picking up a stack of items from the ground while your inventory is only full enough to accept part of the stack, the items remaining on the ground will still appear as if you hadn't picked any up.
To reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Ensure that you are looking in a direction such that dropped items aren't immediately picked back up again
- Fill all of your inventory except for the first hotbar slot with one item (e.g. stone)
- Put a single one of another item (e.g. wool) in the first hotbar slot.
- Middle-click the item to create a stack of 64, and then drop that stack on the ground by clicking outside the inventory.
- Switch to survival mode (/gamemode 0). This is needed because in creative you can pick items up even when the inventory is full.
- Collect the items you dropped previously.
- Note that the item on the ground is visually a full stack, even though you just picked up 63 items and thus the one on the ground is only a single item.
This is a visual glitch only, and is reset by relogging or by tossing another item on the ground that combines with the existing item.
Environment
Windows 7 64-bit, Java version 8 64-bit
Windows 7 64-bit, Java version 8 64-bit
discovered while testing
When picking up a stack of items from the ground while your inventory is only full enough to accept part of the stack, the items remaining on the ground will still appear as if you hadn't picked any up.
To reproduceIt's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Ensure that you are looking in a direction such that dropped items aren't immediately picked back up again
- Fill all of your inventory except for the first hotbar slot with one item (e.g. stone)
- Put a single one of another item (e.g. wool) in the first hotbar slot.
- Middle-click the item to create a stack of 64, and then drop that stack on the ground by clicking outside the inventory.
- Switch to survival mode (/gamemode 0). This is needed because in creative you can pick items up even when the inventory is full.
- Collect the items you dropped previously.
- Note that the item on the ground is visually a full stack, even though you just picked up 63 items and thus the one on the ground is only a single item.
This is a visual glitch only, and is reset by relogging or by tossing another item on the ground that combines with the existing item.
The bug
When picking up a stack of items from the ground while your inventory is only full enough to accept part of the stack, the items remaining on the ground will still appear as if you hadn't picked any up.
How to reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Ensure that you are looking in a direction such that dropped items aren't immediately picked back up again
- Fill all of your inventory except for the first hotbar slot with one item (e.g. stone)
- Put a single one of another item (e.g. wool) in the first hotbar slot.
- Middle-click the item to create a stack of 64, and then drop that stack on the ground by clicking outside the inventory.
- Switch to survival mode (/gamemode 0). This is needed because in creative you can pick items up even when the inventory is full.
- Collect the items you dropped previously.
- Note that the item on the ground is visually a full stack, even though you just picked up 63 items and thus the one on the ground is only a single item.
This is a visual glitch only, and is reset by relogging or by tossing another item on the ground that combines with the existing item.
relates to
The bug
When picking up a stack of items from the ground while your inventory is only full enough to accept part of the stack, the items remaining on the ground will still appear as if you hadn't picked any up.
How to reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Ensure that you are looking in a direction such that dropped items aren't immediately picked back up again
- Fill all of your inventory except for the first hotbar slot with one item (e.g. stone)
- Put a single one of another item (e.g. wool) in the first hotbar slot.
- Middle-click the item to create a stack of 64, and then drop that stack on the ground by clicking outside the inventory.
- Switch to survival mode (/gamemode
0).This is needed because in creative you can pick items up even when the inventory is full.- Collect the items you dropped previously.
- Note that the item on the ground is visually a full stack, even though you just picked up 63 items and thus the one on the ground is only a single item.
This is a visual glitch only, and is reset by relogging or by tossing another item on the ground that combines with the existing item.
The bug
When picking up a stack of items from the ground while your inventory is only full enough to accept part of the stack, the items remaining on the ground will still appear as if you hadn't picked any up.
How to reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Ensure that you are looking in a direction such that dropped items aren't immediately picked back up again
- Fill all of your inventory except for the first hotbar slot with one item (e.g. stone)
- Put a single one of another item (e.g. wool) in the first hotbar slot.
- Middle-click the item to create a stack of 64, and then drop that stack on the ground by clicking outside the inventory.
- Switch to survival mode (/gamemode survival). This is needed because in creative you can pick items up even when the inventory is full.
- Collect the items you dropped previously.
- Note that the item on the ground is visually a full stack, even though you just picked up 63 items and thus the one on the ground is only a single item.
This is a visual glitch only, and is reset by relogging or by tossing another item on the ground that combines with the existing item.
Picking up an incomplete stack of itemsdoesn't visually update the stack left on the groundPicking up an incomplete stack of items is not correctly detected
The bug
When picking upa stack of items from the ground while your inventory isonly fullenough to accept part of the stack, the items remaining on the ground will still appear as if you hadn't picked any up.
How to reproduceIt's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Ensure that you are looking in a direction such that dropped items aren't immediately picked back up again
- Fill all of your inventory except for the first hotbar slot with one item (e.g. stone)
- Put a single one of another item (e.g. wool) in the first hotbar slot.
- Middle-click the item to create a stack of 64, and then drop that stack on the ground by clicking outside the inventory.
Switch to survival mode (/gamemode survival). This is needed because in creative you can pick items up even when the inventory is full.- Collect the items you dropped previously.
- Note that the item on the ground is visually a full stack, even though you just picked up 63 items and thus the one on the ground is only a single item.
This is a visual glitch only, and is reset by relogging or by tossing another item on the ground that combines with the existing item.
The bug
Picking up only a part of an item stack of an item entity because your inventory is nearly full is not correctly detected by the server causing:
- Server-side:
- Missing statistics change
- Client-side:
- Missing sound and animation
- Item stack of item entity not updated
How to reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Fill all of your inventory except for the first hotbar slot with one item (e.g. wooden swords), fill the hotbar slot with a nearly full stack of for example stone
/give @s wooden_sword 36 /replaceitem entity @s hotbar.0 stone 63- Switch to survival mode (This is needed because in creative you can pick items up even when the inventory is full.)
/gamemode survival- Summon an item entity containing two stone items
/summon item ~ ~ ~ {Item:{id:"stone",Count:2b}}→
The item entity still shows two items, there was no sound, no animation, etc.
Code analysis
Based on 1.12.2 decompiled using MCP 9.40
The method net.minecraft.entity.item.EntityItem.onCollideWithPlayer(EntityPlayer) tests if net.minecraft.entity.player.InventoryPlayer.addItemStackToInventory(ItemStack) returns true. Since this is only the case if the complete stack was picked up, it should instead test if the stack size decreased.
The following shows the problems with the current code:
ItemStack itemstack = this.getItem(); Item item = itemstack.getItem(); int i = itemstack.getCount(); // Don't test for entityIn.inventory.addItemStackToInventory(itemstack) == true if (this.pickupDelay == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) { // Change this, picked up count can be < i entityIn.onItemPickup(this, i); if (itemstack.isEmpty()) { this.setDead(); itemstack.setCount(i); } // Change this, picked up count can be < i entityIn.addStat(StatList.getObjectsPickedUpStats(item), i); }
is duplicated by
relates to
is duplicated by
is duplicated by
The bug
Picking up only a part of an item stack of an item entity because your inventory is nearly full is not correctly detected by the server causing:
- Server-side:
- Missing statistics change
- Client-side:
- Missing sound and animation
- Item stack of item entity not updated
How to reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Fill all of your inventory except for the first hotbar slot with one item (e.g. wooden swords), fill the hotbar slot with a nearly full stack of for example stone
/give @s wooden_sword 36 /replaceitem entity @s hotbar.0 stone 63- Switch to survival mode (This is needed because in creative you can pick items up even when the inventory is full.)
/gamemode survival- Summon an item entity containing two stone items
/summon item ~ ~ ~ {Item:{id:"stone",Count:2b}}→
The item entity still shows two items, there was no sound, no animation, etc.
Code analysis
Based on 1.12.2 decompiled using MCP 9.40
The method net.minecraft.entity.item.EntityItem.onCollideWithPlayer(EntityPlayer) tests if net.minecraft.entity.player.InventoryPlayer.addItemStackToInventory(ItemStack) returns true. Since this is only the case if the complete stack was picked up, it should instead test if the stack size decreased.
The following shows the problems with the current code:
ItemStack itemstack = this.getItem(); Item item = itemstack.getItem(); int i = itemstack.getCount(); // Don't test for entityIn.inventory.addItemStackToInventory(itemstack) == true if (this.pickupDelay == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) { // Change this, picked up count can be < i entityIn.onItemPickup(this, i); if (itemstack.isEmpty()) { this.setDead(); itemstack.setCount(i); } // Change this, picked up count can be < i entityIn.addStat(StatList.getObjectsPickedUpStats(item), i); }The bug
Picking up only a part of an item stack of an item entity because your inventory is nearly full is not correctly detected by the server causing:
- Server-side:
- Missing statistics change
- Client-side:
- Missing sound and animation
- Item stack of item entity not updated
How to reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Fill all of your inventory except for the first hotbar slot with one item (e.g. wooden swords), fill the hotbar slot with a nearly full stack of for example stone
/give @s wooden_sword 36 /item entity @s hotbar.0 replace stone 63- Switch to survival mode (This is needed because in creative you can pick items up even when the inventory is full.)
/gamemode survival- Summon an item entity containing two stone items
/summon item ~ ~ ~ {Item:{id:"stone",Count:2b}}→
The item entity still shows two items, there was no sound, no animation, etc.
Code analysis
Based on 1.12.2 decompiled using MCP 9.40
The method net.minecraft.entity.item.EntityItem.onCollideWithPlayer(EntityPlayer) tests if net.minecraft.entity.player.InventoryPlayer.addItemStackToInventory(ItemStack) returns true. Since this is only the case if the complete stack was picked up, it should instead test if the stack size decreased.
The following shows the problems with the current code:
ItemStack itemstack = this.getItem(); Item item = itemstack.getItem(); int i = itemstack.getCount(); // Don't test for entityIn.inventory.addItemStackToInventory(itemstack) == true if (this.pickupDelay == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) { // Change this, picked up count can be < i entityIn.onItemPickup(this, i); if (itemstack.isEmpty()) { this.setDead(); itemstack.setCount(i); } // Change this, picked up count can be < i entityIn.addStat(StatList.getObjectsPickedUpStats(item), i); }
is duplicated by
The bug
Picking up only a part of an item stack of an item entity because your inventory is nearly full is not correctly detected by the server causing:
- Server-side:
- Missing statistics change
- Client-side:
- Missing sound and animation
- Item stack of item entity not updated
How to reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Fill all of your inventory except for the first hotbar slot with one item (e.g. wooden swords), fill the hotbar slot with a nearly full stack of for example stone
/give @s wooden_sword 36 /item entity @s hotbar.0replacestone 63- Switch to survival mode (This is needed because in creative you can pick items up even when the inventory is full.)
/gamemode survival- Summon an item entity containing two stone items
/summon item ~ ~ ~ {Item:{id:"stone",Count:2b}}→
The item entity still shows two items, there was no sound, no animation, etc.
Code analysis
Based on 1.12.2 decompiled using MCP 9.40
The method net.minecraft.entity.item.EntityItem.onCollideWithPlayer(EntityPlayer) tests if net.minecraft.entity.player.InventoryPlayer.addItemStackToInventory(ItemStack) returns true. Since this is only the case if the complete stack was picked up, it should instead test if the stack size decreased.
The following shows the problems with the current code:
ItemStack itemstack = this.getItem(); Item item = itemstack.getItem(); int i = itemstack.getCount(); // Don't test for entityIn.inventory.addItemStackToInventory(itemstack) == true if (this.pickupDelay == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) { // Change this, picked up count can be < i entityIn.onItemPickup(this, i); if (itemstack.isEmpty()) { this.setDead(); itemstack.setCount(i); } // Change this, picked up count can be < i entityIn.addStat(StatList.getObjectsPickedUpStats(item), i); }The bug
Picking up only a part of an item stack of an item entity because your inventory is nearly full is not correctly detected by the server causing:
- Server-side:
- Missing statistics change
- Client-side:
- Missing sound and animation
- Item stack of item entity not updated
How to reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Fill all of your inventory except for the first hotbar slot with one item (e.g. wooden swords), fill the hotbar slot with a nearly full stack of for example stone
/give @s wooden_sword 36 /item replace entity @s hotbar.0 with minecraft:stone 63- Switch to survival mode (This is needed because in creative you can pick items up even when the inventory is full.)
/gamemode survival- Summon an item entity containing two stone items
/summon item ~ ~ ~ {Item:{id:"stone",Count:2b}}→
The item entity still shows two items, there was no sound, no animation, etc.
Code analysis
Based on 1.12.2 decompiled using MCP 9.40
The method net.minecraft.entity.item.EntityItem.onCollideWithPlayer(EntityPlayer) tests if net.minecraft.entity.player.InventoryPlayer.addItemStackToInventory(ItemStack) returns true. Since this is only the case if the complete stack was picked up, it should instead test if the stack size decreased.
The following shows the problems with the current code:
ItemStack itemstack = this.getItem(); Item item = itemstack.getItem(); int i = itemstack.getCount(); // Don't test for entityIn.inventory.addItemStackToInventory(itemstack) == true if (this.pickupDelay == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) { // Change this, picked up count can be < i entityIn.onItemPickup(this, i); if (itemstack.isEmpty()) { this.setDead(); itemstack.setCount(i); } // Change this, picked up count can be < i entityIn.addStat(StatList.getObjectsPickedUpStats(item), i); }
The bug
Picking up only a part of an item stack of an item entity because your inventory is nearly full is not correctly detected by the server causing:
- Server-side:
- Missing statistics change
- Client-side:
- Missing sound and animation
- Item stack of item entity not updated
How to reproduce
It's easiest to reproduce this by starting in creative mode and then switching to survival partway through.
- Fill all of your inventory except for the first hotbar slot with one item (e.g. wooden swords), fill the hotbar slot with a nearly full stack of for example stone
/give @s wooden_sword 36/item replace entity @s hotbar.0 with minecraft:stone 63- Switch to survival mode (This is needed because in creative you can pick items up even when the inventory is full.)
/gamemode survival- Summon an item entity containing two stone items
/summon item ~ ~ ~ {Item:{id:"stone",Count:2b}}→
The item entity still shows two items, there was no sound, no animation, etc.
Code analysis
Based on 1.12.2 decompiled using MCP 9.40
The method net.minecraft.entity.item.EntityItem.onCollideWithPlayer(EntityPlayer) tests if net.minecraft.entity.player.InventoryPlayer.addItemStackToInventory(ItemStack) returns true. Since this is only the case if the complete stack was picked up, it should instead test if the stack size decreased.
The following shows the problems with the current code:
ItemStack itemstack = this.getItem(); Item item = itemstack.getItem(); int i = itemstack.getCount(); // Don't test for entityIn.inventory.addItemStackToInventory(itemstack) == true if (this.pickupDelay == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) { // Change this, picked up count can be < i entityIn.onItemPickup(this, i); if (itemstack.isEmpty()) { this.setDead(); itemstack.setCount(i); } // Change this, picked up count can be < i entityIn.addStat(StatList.getObjectsPickedUpStats(item), i); }
is duplicated by
is duplicated by
is duplicated by
Resolved in favor of MC-120643, this issue is included there now.
Resolved in favor of MC-120643, this issue is included there now.
Does MC-120643 describe your issue?
Duplicate of MC-120643
Thank you for your report!
We're tracking this issue in MC-120643, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! Please report any issues on Discord or Reddit
This ticket is actually a duplicate of MC-120643.
Thank you for your report!
We're tracking this issue in MC-120643, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
Thank you for your report!
We're tracking this issue in MC-120643, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Can confirm in 20w48a. For Step 2, since the /replaceitem command was replaced with /item, here's the updated use.
Confirmed for 51a
Can confirm in 21w05b.
Can confirm for 1.16.5
Here's the updated command for the first reproduction step:
Can confirm in 1.17.1.
Can confirm in 1.18.1.
Can confirm in 1.19.
Can confirm in 1.19.1.