Paint gun sdaweda

i made paint gun by shooting snowball then creating locations around a snowball every tick and checking if there is a block at those locations to replace with another block and it works fine but the code is long and if 2 snowball exist at once the limit of command will reach per 5 tick if i increase the delay the block detection will be harder and less effective is there a more efficient way to code it?

so basically u want to code a gun right?
just use trigonometry to do it do /ad ezez

bruh read what i wrote properly

tbh i didnt understood what u wrote u want to make a bridge egg?

Maybe you can get players target block location and by changing the location u can determine if theres a block or not and placing the target block instead if there is. But the code might be longer. Not a better solution but you don’t have to use loops for this one

i have already made a paint gun, it shoots a snowball, then it detects blocks around the snowball and replaces blocks for example white wool to red wool, the problem is that the code is very long and alot of code blocks are executed per tick, mineland can only execute 400 (+200 per player i think) code blocks per 5 ticks. when i shoot 2 snowballs at once an the error is shown “the limit of calls to the command chain for 5 ticks was reached (401/400)”

that would act like a paint brush not a paint gun

what he meant was u shud check if the block that the player looking at is air or not so u dont need to set up a loop to check the snowball interacts with a block

Wdym? If you use multiple block equals and set locations it will work.

the blocks would get instantly replaced with player target block. the projectile should come close to the block before the block gets replaced. i am already using multiple if block equals i tried with 26 locations around the snowball