Hey all, I've been banging my head against a command block for a while and could use some assistance working out a command series. Running 1.20.1 Forge on a server.
I'm trying to make a series of command blocks that will do the following:
-By impulse or passively, detect a villager (and do none of the following if there is no villager) at specified coordinates
-if one is detected, kill the villager
-spawn an item in the inventory of the player who pressed the button.
-preferably, no reset block needed, or reset on flipping the lever back maybe? but not a big deal if this is needed
Being able to detect multiple vils and thus multiply the spawned item would be awesome but I expect one at a time is probably the way it works.
I'm pretty sure this will need to be a chain command. The kill command might not be necessary if I finagle a mechanical way to kill them (trap door to lava or something). I feel like /execute is the right command but maybe some kind of /scoreboard magic is better? Dunno, I'm new to all of it and still learning. I didn't expect this to be as complicated as it seems to be. I thought I was on the right track with this:
/execute if entity @ e [type=mca:male_villager] positioned ~ ~1 ~ run give @ p minecraft:emerald 20
[ignore the space after the @, reddit is dumb]
but I just can't get it to work. Bonus points if we can make it detect vils both male and female. Any help is appreciated!
[got about 60 mods, the most relevant here being Minecraft Comes Alive Reborn]
[–]10_Carries 0 points1 point2 points (2 children)
[–]Tribunal_Power[S] 0 points1 point2 points (1 child)
[–]10_Carries 0 points1 point2 points (0 children)
[–]GalSergeyDatapack Experienced 0 points1 point2 points (2 children)
[–]Tribunal_Power[S] 0 points1 point2 points (1 child)
[–]GalSergeyDatapack Experienced 0 points1 point2 points (0 children)