Topic category: Help with Minecraft modding (Java Edition)
I'm trying to work on a mod that has horror elements where you play as characters in the mod to scare unsuspecting players.
I have a rough draft of how this would work.
You press a key bind to run a procedure that detects if a player is near, then it places a tag on the player it detected with a limit of one. Then it teleports you to that player, facing you towards the player's head and facing the player towards your head. It then applies slowness and blindness to the target, plays a cave noise and then it's over. If anybody could help with examples of how this may work, that'd be greatly appreciated. I've been stumped for a while now.
At the moment, I'm detecting if the player is sneaking just to make it easier to test along with the single nbt tag for the boot slot. Along with that, I'm using iron armor as a placeholder for the finished product.
I'm kind of confused on what you are doing, but I think I can help. You can check with the if entity exists in a certain range block to see if there is a player nearby. If it finds a player, teleport the source entity to the target entity. Then play cave noise, give target entity blindness for a short amount of time. If I am understanding this wrong, tell me and I'll try to help you.
That's precisely what I'm trying to do, I just...don't know what blocks to use and where to put them, it's stumping me how to check for a nearby player and such. I can't find a code block that would do anything like that and the next thing is to integrate commands to make it work
What I have currently in the screen shot just detects if I'm wearing a specific set of armor and then if I crouch, but if I had a visual representation of what the block coding would look like to detect a player and manipulate them the way you're saying, that'd help. I've found a few blocks that check for an entity with a square cube radius but they won't attach to the block that I'd be using to check.
In this screenshot, i try to attach what I'd presume to be one of my only ways of detecting/finding the nearest entity near.
It doesn't attach to the AND block input, if it did then I'd hopefully be able to figure the rest out a bit faster.
The next thing I can try to do is detect if I'm looking at the entity I want to jumpscare instead of just picking one that's nearby. By using ray traced detection
Give me some time, but I can send you some screenshots of what blocks and where to put them.
Alright, I'm working on 1.18.2 so there's no translation error
Any update??
Sorry for taking a bit.
It's alrighty, I'm gonna test this on animals, my next concern is forcing the target to look at you
So what this does, is it detects if the specified entity is near, then it gives you the blindness and plays the noise on you instead of teleporting you to the target and giving it blindness
But I do think we're on the right track here with what blocks were used.
Hmm. It is probably to do with the source entity and target entity blocks. Try swaping them.
Using it as a keybind ability doesn't work because of it having a source entity block