Help with paintball effect on walls when shoot gun.

Discussion in 'Spigot Plugin Development' started by Orangemaster123, May 28, 2017.

  1. I have made a paintball gun that when the snowball from the gun hits the floor "paint splatters" or the block it landed on and some around get replaced by coloured wool for 3 seconds. But if you fire the gun at the wall, the wool appears like it does on the floor, so the wool is horizontal. Is there a way to see if it is on a wall so i can change the paint effect to go vertical?
  2. Eh, try seeing if the Y of the block hit is greater than the Y of the player. Or, possibly, check if the snowball has positive Y velocity or not during the collision.
  3. I assume you set the horizontally adjacent blocks to colored wool currently?
    You could check for all adjacent blocks and only set the block to colored wool, if the adjacent block is not air. That way you don't have to differentiate between walls and floors / ceilings. You just apply your splatter effect to all nearby blocks, regardless of if the block is a wall or floor.
    With this the splatter could even affect both, floor and wall, at the same time (if you shoot right into the edge between a floor and a wall).
    • Agree Agree x 1
  4. Check which block the paintball hit, then for all blocks surrounding it check if they're not equal to air/signs/whatever you want to not change, then change those to wool.
  5. @blablubbabc & @DamaTheDev Thanks this worked!