Started by
Purple19842
on
Topic category: Advanced modding
i need some way to get the block that a projectile hits, break it and give it to the player
i tried putting the get block at x/y/z in the add to inventory block, but that wont work
isnt it possible to add a procedure for when the projectile hits a block to save the block to a variable, break it and add it to the players inventory? (ignoring all the checks for hardness type etc.)
I Thought so too, but the variable blocks wont connect to the add item block
You should be able to use the different entity types (source entity, and immediate source entity) to determine the entitythat shot the arrow and give the item to them directly without saving it to a variable. If you can't, dont save the block to a variable, use the UUID plugin to save the UUID of the entity that shot the projectile to the projectile as a string nbt variable(entityUUID). Then for the procedure "when the projectile hits a block" do
for every player in the world OR for each entity in certain radius
if UUID of entity iterator == entityUUID
give player block