I'm currently programming on a BedWars plugin and just can't get the items to spawn and stay on the block. With world.dropItem () or world.dropItemNaturally () they unfortunately always spawn too dispersed and fall off the BedWars island: /
I have now tried it with the world.spawnEntity (), but unfortunately I get an error:
java.lang.IllegalArgumentException: Can't spawn an entity for org.bukkit.entity.Item
Does anyone know how I can solve the problem so that the items drop and just stay there?
I don't know much about plugins myself, an idea would be that (if you don't do it already) you spawn the items one block higher so that they don't bug the ground. The other idea would be that you automatically "pick up the items with a command, i.e. Teleport to the correct block:-)
Okay thanks. I already do the first with the higher spawning. I'll try the second one
I have now managed it! If someone is interested:
It has nothing to do with teleporting. It's easy with e.setVelocity (new Vector (0.00));
And to make it look better e.setVelocity (new Vector (0,0.18,0));
Sorry, completely forgotten. E is the item (entity)
Just do "world.dropItem ();"
"Entity e ="
So then → Entity e = world.dropItemNaturally (location, itemstack);