Christian Lewis Posted May 17, 2025 Report Posted May 17, 2025 (edited) ItemStack stack = new ItemStack(); stack = byPlayer.InventoryManager.ActiveHotbarSlot.Itemstack; EntityItem item =(EntityItem) sapi.World.SpawnItemEntity(stack, byPlayer.Entity.Pos.XYZ.Add(0, 1, 0)); This creates a copy of whatever is in the player's hand, but once spawned in, it's un-collectable until server restart (after server restart, it returns to normal). I checked .canCollect() and it returns false. Thank you for any help to make this entity collectable. Edit: also tested without making the entity a EntityItem forcefully, still doesn't work Edited May 19, 2025 by Christian Lewis Fixed the issue.
Christian Lewis Posted May 19, 2025 Author Report Posted May 19, 2025 Fixed: stack was being considered as already picked up, as it wasnt a copy of the item in hand, it was the item held in hand, so the game basically though what was in my hand was on the ground, and it wouldn't be recognized as a pickupable itemstack. This is easily fixed by doing stack.SetFrom(byPlayer.InventoryManager.ActiveHotbarSlot.Itemstack); instead of setting it equal to it.
Recommended Posts