Topic category: Help with Minecraft modding (Java Edition)
I am trying to make a horror type mod. I want the mobs I make to feel like a player.
Here is what I have so far.
1: Under Ai for a mob you can give them the power to break a block. if they in counter that block there is a chance they will break it.
seems to work fine if u don't pick grass/dirt or stone as they can dig them self into a hole. So I keep it but it is not really the best.
2: under triggers, I can use "when mob is hurt" to have it respond to your attack & I can put things like "swing main hand" and place block or spawn mob after to make it feel more like they are placing the thing as a way to fight back.
if I want this to be something they do randomly, I can put it under, when mob falls & the player might randomly see the mob stop & place down a sign or randomly leave things around the world.
3: I can make a variable & it will tick up each time you kill the mob & give the mob the power to respawn after death a set number of times.
4: I can set the mob to attack not only the player but a cow or pig & when they start to attack they will look for a pig & walk up to it & swing main hand & I can remove the pig & spawn a custom pig I make, to make it seem like they are turning mobs into evil things.
The one thing I can't seem to do is detect when the mob is blocked by a wall & a player would just break the block to get to his target, but I don't want the block to just break right away & I would need to know where the mob is looking to only break the block in-front of them & drop the block or maybe hold the block in his hand after so the player might see that. Yet how do I detect a block & make the mob look at that block & swing his hand 4 times & make a sound for that & copy the block in that time & break the block & have the copy drop. Only part I don't know is how to detect what the mob is looking at & if that is a wall they should try to break. Can they actively look for blocks to break? or how can you detect what a mob is looking at & command them to break it if it is not air? if I knew that I could make a list of block types I want them to break. Is there a way to detect the direction the mob is looking so I can check if a wall happens to be in-front of him & then he could take action. I may know how to set up the action but not the detection.
also Any other suggestions?
You can use ray-tracing procedures. I think there is procedure block "get position entity is looking at" which should help you with that