BLOCK_PROJECTILE_BLOCK never seems to trigger.
LadyCailinBot opened this issue ยท 14 comments
CRAFTBOOK-2959 - Reported by jjkrause
I tested BLOCK_PROJECTILE_BLOCK and BLOCK_PROJECTILE_AIR. I can never get the command-item to trigger when using BLOCK_PROJECTILE_BLOCK. I tested with bow/arrows and with snowballs. When the projectile hits a block, nothing happens. Using BLOCK_PROJECTILE_AIR triggers when the projectile hits a block though. I wonder, when the collision is registered, is it possible the projectile is still in an air block?
Comment by jjkrause
The only exception is shooting an arrow into water. When the arrow hits the bottom, commands are triggered with BLOCK_PROJECTILE_BLOCK as the arrow was flying through water, not air.
Comment by jjkrause
Another exception... shooting through grass and hitting a block behind. You get the idea. Its not registering the block being hit, but a block or two in front.
Comment by me4502
Hrm, maybe the arrows position isn't updated after a certain point. That may not actually be fixable, as arrows have no velocity at that stage I can't work out the next block for them.
Comment by jjkrause
Ok, with the 10 tick delay, when I throw a snowball for example, I get the coords of the block being hit compared to a few blocks ahead like before, so thats excellent. The delay is noticeable though, what was it set to before?
Comment by jjkrause
BLOCK_PROJECTILE_BLOCK still only triggers when the arrow is sitting in grass or water. I guess this makes sense if you think of it this way. A snowball with be destroyed on contact so it will return the xyz of the block it hit. An arrow will return the xyz of the block the arrow is sitting in once it hits a block, not the xyz of the block it hit.
If the arrow is sitting in grass or water, BLOCK_ENTITY_BLOCK will trigger, if the arrow is sitting in air, BLOCK_ENTITY_AIR will trigger. As for the snowballs/pearls, BLOCK_ENTITY_AIR will never trigger, as the these projectiles return the xyz of the block they hit and it can never be air.
Comment by me4502
Hrm, it was not delayed at all before. Maybe I'll make it only delay for arrows?
Comment by jjkrause
No, the snowballs weren't registering properly before the delay. Maybe try less of a delay just to see, like 4-5 ticks instead of 10. (Is it better for an even number of ticks delay?)
Comment by me4502
Uh, I don't think it matters if its even. I'll just make it 5 ticks.
Snowballs may not be calling the event
Comment by jjkrause
BLOCK_PROJECTILE_BLOCK is definitely triggering on a snowball collision, I just retested it. (note in my comments above I mention BLOCK_ENTITY_AIR and BLOCK_ENTITY_BLOCK, but replace ENTITY with PROJECTILE).
Comment by jjkrause
I think everything is fine at the moment. As long as people understand the following when using BLOCK_PROJECTILE_BLOCK and _AIR:
-
BLOCK_PROJECTILE_BLOCK
Snowballs/Eggs/Pearls: Will trigger whenever the items hit any block, even non-solid such as grass, flowers. Will not trigger when hitting a mob and the collision happened in an AIR block.
Arrows: Will only trigger if the arrow is sitting in a non-solid block such as grass/flowers, water, button, ladder, etc. It is not looking at the block the arrow hit, but the actual block where the arrow is located. If you shoot an arrow on a block and the arrow is sitting in an AIR block, BLOCK_PROJECTILE_BLOCK will not trigger. -
BLOCK_PROJECTILE_AIR
Snowballs/Eggs/Pearls: Will only trigger if you hit an mob or player and the collision happens in an AIR block. It will never trigger when hitting a block, as no collision can exist with an AIR block.
Arrows: Will only trigger if the arrow is sitting in AIR. If you shoot an arrow at a block and the arrow is sitting in water/grass/button/ladder, it will not trigger.
Comment by jjkrause
Something that would be useful is to be able to differentiate between hitting a player or any mob. Presently, ENTITY_LEFT and ENTITY_RIGHT triggers no matter what you hit, such as another player or a cow. Could we maybe get a PLAYER_LEFT/RIGHT as well as MOB_LEFT/RIGHT? For example, I have a hockey game where the puck is a black cat. I want to add a feature where if you hit the opposing player for lets say 10 times with your hockey stick, you get TPed to the penalty box for 10-15 seconds. With COMITEMS, I can count the number of times an entity is hit, but the problem is at the moment with ENTITY_LEFT, I cannot tell the difference if the player is hitting the puck, or the opposing player.
Even taking this further, being able to differentiate between Friendly and Hostile mobs could be useful as well. Example: The player is provided with a bow and there are moving mobs in the distance. His score increases when hitting hostile mobs, and decreases when hitting friendly mobs. I checked and Friendlys are classified as ENTITY.ANIMALS, whereas Hostiles are classified as ENTITY.MONSTER. Squid are ENTITY.WATERMOB. Things to ponder...