Regular snowball triggers Command-Item commands
LadyCailinBot opened this issue ยท 11 comments
CRAFTBOOK-2939 - Reported by jjkrause
I have the following command item defined:
Test:
item: SNOW_BALL*5|TestBall
commands:
- say Test
permission-node: ''
run-as: SUPERUSER
click-type: BLOCK_PROJECTILE
delay: 0
cooldown: 0
cancel-action: true
consumed-items: []
consume-self: false
require-sneaking-state: NONE
keep-on-death: false
actions: {}
If I give myself 5 regular snowballs and throw them against a wall, all is fine except for the very last snowball that runs the commands under the TEST command-item when it hits a block.
Comment by jjkrause
Is there any way of giving an infinite stack of any command item? Other than a quantity of -1, which causes the above problems?
Comment by jjkrause
Also, BLOCK_PROJECTILE triggers when hitting an entity. If I have a snowball Command-Item set to click-type BLOCK_PROJECTILE, it should only trigger the commands if I hit a block, but at the moment, it triggers when hitting a block or any entity/mob.
Comment by me4502
As for block projectile, it's because it's hitting against an air block. I'm not sure if I'll be able to fix this, as it sometimes sees it as air when it's a proper hit
Comment by jjkrause
Ok... that's unfortunate. Can the event be ignored if the block is AIR?
In the basketball game I'm making, I need to run a different set of commands if I hit a player with the snowball, than if I miss my teammate and hit the ground. If I hit the player, I transfer the snowball to the player that was hit, if I miss and hit the ground, I spawn another snowball. Right now, when I hit the player, it transfers the ball AND spawns another ball on the ground next to him. I'll try to find another way of doing it. Thanks.
Comment by me4502
How about, PROJECTILE_BLOCK_SOLID? An event that only fires for solid?
Comment by jjkrause
So what you're saying is the way it is now, BLOCK_PROJECTILE will trigger when an entity is hit because the projectile is in an AIR block when the collision happens? If that's the case, yes it should only trigger when hitting a solid block. I can't quite think of any use of having it trigger when its in an AIR block...
Comment by me4502
Yeah, I'll make a block and air one, that'd make the most sense. So people can choose what they want. I'll also add an either, just incase.
Comment by jjkrause
Ok, I have more information about the issue with regular projectiles triggering COMMAND-ITEMS commands. Remember when you told me that ENTITY_PROJECTILE doesn't work if you throw your last snowball of your stack? That you had to be holding a command-item snowball in your hands for the thrown snowball to trigger? What I did was create an infinite stack using "item: 332*-1|Basketball" in my Command-Items file. That way, the player would never run out of snowballs. But having -1 for the quantity seems to be causing the problem. With that command-item defined, if I have a single snowball or egg in my inventory and throw it, it will trigger the command-item commands. It only triggers if I have no other in my inventory. So, if I have a stack of 5 regular snowballs, the commands will only trigger on the last snowball thrown.