#Doesnt run my command

1 messages · Page 1 of 1 (latest)

abstract linden
#

execute as Bot at @s if entity @e[type=armor_stand,distance=..10] run function trapessentials:hit in tick.mcfunction
and in hit.mcfunction i have say i hat it and it never runs
im on 1.21.11

abstract linden
#

Anyone?

unkempt cragBOT
#

-# (helpers summoned) <@&1166082198152159386> <@&1202694677766348840>

ebon kestrel
#

try putting a random say command in your tick function to see if it's set up correctly

#

when you reload the chat should spam whatever you put in the say command

#

if not, then your tick function isn't set up correctly

manic sorrel
#

execute as name runs only if there is a player with that name.. if you are trying it for randomentity named bot it will not work

ebon kestrel
#

that too

manic sorrel
#

also you dont need @e in that situation.. you can use @n and it will have exactly the sane effect but it will be a lot more efficient

manic sorrel
wind thicket
#

@n still has to search through all entities to find the nearest one

#

you could write @e[limit=1] to increase efficiency but that's not the problem here

manic sorrel
abstract linden
ebon kestrel
# abstract linden it doesnt?

alrighty then the problem is either that your tick function isn't being read by the game, or you haven't correctly set up the tick.json file to tell it to run every tick

abstract linden
#

{
"values": [
"trapessentials:tick"
]
}

ebon kestrel
#

does the function run when you manually run it in chat with /function?

abstract linden
#

is my tick.json

ebon kestrel
#

what about tick

abstract linden
#

it says bob

#

as it should

ebon kestrel
#

hmm okay

#

where's your tick.json saved?

abstract linden
#

its minecraft/tags/functions right

ebon kestrel
#

ahh

#

/minecraft/tags/function/tick.json

manic sorrel
#

s

ebon kestrel
#

function should be singular ;)

abstract linden
#

man i feel dumb

ebon kestrel
#

nahhh we've all been there :P

manic sorrel
#

dw it was with s it got changed in update

ebon kestrel
#

yea it was super annoying lol

abstract linden
#

I had this question too that

item replace block ~ ~ ~ container.0 with minecraft:armor_stand 16
item replace block ~ ~ ~ container.1 with minecraft:armor_stand 16
item replace block ~ ~ ~ container.2 with minecraft:armor_stand 16
item replace block ~ ~ ~ container.3 with minecraft:armor_stand 16
item replace block ~ ~ ~ container.4 with minecraft:armor_stand 16
item replace block ~ ~ ~ container.5 with minecraft:armor_stand 16
item replace block ~ ~ ~ container.6 with minecraft:armor_stand 16
item replace block ~ ~ ~ container.7 with minecraft:armor_stand 16
item replace block ~ ~ ~ container.8 with minecraft:armor_stand 16

doesnt work? i call it from here: execute as @s at @s anchored eyes positioned ^ ^ ^ if block ~ ~ ~ minecraft:dispenser run function trapessentials:fill/nine

#

doesnt put anythin inside

ebon kestrel
#

or like the current position, or like whatever block they are looking at?

abstract linden
ebon kestrel
abstract linden
#

the one your looking at

ebon kestrel
#

ahh okay

#

this is harder than you'd expect - in order to get the block that the player is looking at you have to do a raycast

abstract linden
#

bruh

unkempt egretBOT
ebon kestrel
#

the concept isn't too difficult but it is a lil bit of work for something that you would expect to be quite easy

abstract linden
#

oof

#

thats hard :/

ebon kestrel
#

if you follow the guide you should be able to manage it :P

abstract linden
#

uhh the hit one

#

its if it hit an entity not block right?

ebon kestrel
#

yeah. in your case, instead of checking for hitting an entity hitbox you can literally just check for the block at ~ ~ ~

abstract linden
#

How do I use it? Do i put start in the execute

#

Orrr

#

-# sorry for the stupid questions

ebon kestrel
#

id reccomend you read through the guide first so you understand what it does and how it works :P

#

but basically it runs a function, checks if there is something there, and if not then it runs the function again but this time slightly in front of last time

#

and it does this until it hits something

#

to run it, just run the start function as the player :P

abstract linden
ebon kestrel
#

execute as @s does nothing, but yeah

abstract linden
ebon kestrel
abstract linden
#

execute positioned ~-.99 ~-.99 ~-.99 as @e[dx=0,tag=!raycaster] positioned ~.99 ~.99 ~.99 as @s[dx=0] run return run function <namespace>:hit
Imma be honest this isnt telling me anythinh

ebon kestrel
#

yep, that's the one - it's a confusing command but it basically just checks for any entities which intersect that point

#

you don't need it, so instead you can literally just do execute if block ~ ~ ~ dispenser run ... or something

abstract linden
#

execute if block ~ ~ ~ dispenser run ...
execute if block ~ ~ ~ #shulker_box run ...
execute if block ~ ~ ~ hopper run ...
execute if block ~ ~ ~ barrel run ...

#

Would that be laggy orr

ebon kestrel
#

you can add these all to a block tag and check for the block tag, if you want

abstract linden
ebon kestrel
#

then your method is fine :P

abstract linden
#

Or do i need to manually check

#

Maybe a website or sum

ebon kestrel
#

i don't know of any tools for that

silent prism
#

-# although if you end up finding one, please let me know :P

abstract linden
#

If i get a list of when stuff was added i can probably make a tool for that

manic sorrel
#

i saw one datapack that does exactly that while i was browsing modrinth..

manic sorrel
#

hmm wait.. i might read that wrong..

#

sry

gritty imp