[Suggestion] Detect professional blocK
Lolor63 opened this issue · 28 comments
Add a way to detect the professional bloc of the villager,
By the track command and a new item, like the system to detect bed but for professional block, with a radius they can detect or not =)
i thought bloc as in the profession carrier, like white robes for cartographer and librarian. It's just cos both bloc and block are english words. This couls actually be pretty useful
Yes you're right, i will try on scarpet, i have to do some researsh to do that but well, i tell you if i succeed..
For the bloc or block, i don't what is good, it's like a compost blocK for a farmer villager, sorry i'm not an english man =)
ill give you what I have, if u wanna do it, and I gotta go rn:
brain=e~'nbt':'Brain';
mem=brain:'memories';
pos=mem:'"minecraft:job_site"':'"pos"';
pos
is rn a string. You just gotta take out the commas and stuff, and then thats about it
@Lolor63
btw, bloc and block are completely different. EU is a trade bloc, composter is a farming block
Never mind, I did it myself:
Gnembon, this may be useful, so I'll add (at some point) to the scarpet repo!
__on_player_uses_item(player, item_tuple, hand)->(
if(item_tuple:0=='blaze_rod',
entity=query(player,'trace',20,'entities')||null;
if(type(entity)=='entity'&&entity~'type'=='villager',
brain= entity~'nbt':'Brain';
mem=brain:'memories';
pos=mem:'"minecraft:job_site"':'"pos"'||null;
if(!pos,return());
l(x,y,z)=nbt(pos):'[]';
particle_line('happy_villager',pos(entity),pos(player));
particle_line('happy_villager',pos(entity),l(x+0.5,y+0.5,z+0.5),0.1);
)
)
)
and do tell me when you got the app please, I wanna see it.
And then close this issue
yes, that's great. I would remove that return()
cause you don't want to have exception thrown and caught every time a player uses an item.
Actually, @Lolor63 try it now, with the exta line at the bottom to see exactly which villager you're pointing at
And I had made a mistake, so use it now
that last edit is so that I don't entity trace avry time I use item, only if clicking with blaze rod
Hi @Ghoulboy78, woa that's perfect, I tried without success since someone day, thank you for your job!
Nothing more, i've tried his eventtest script, work properly,
I just found a gnembon script for villager but don't work for me
r u on any technical server? cos then it's easier to find you
if not just, like, join scicraft and then I'll dm you
so you open a command block
then you type /script run __on_player_uses_item(player, item_tuple, hand)->(if(item_tuple:0=='blaze_rod',entity=query(player,'trace',20,'entities')||null;if(type(entity)=='entity'&&entity~'type'=='villager',brain=entity~'nbt':'Brain';mem=brain:'memories';pos=mem:'"minecraft:job_site"':'"pos"'||null;if(!pos,return());l(x,y,z)=nbt(pos):'[]';particle_line('happy_villager',pos(entity),pos(player));particle_line('happy_villager',pos(entity),l(x+0.5,y+0.5,z+0.5),0.1))))
and then activate once, then break command block.
It should work, @Lolor63
whats pnj? you have to click from a distance, or it fails, and u open villager gui. If you click jobless villager, nothing happens. If you click villager with job, it makes particle line to the workstation
what i thought. Put it into a .sc file- If you don't know what that is. go to https://www.youtube.com/watch?v=XQprFbtVAV8
gnembon explains here
for the .sc file copy the first code i posted, up above #268 (comment)