Started by
AcousticJamm
on
Topic category: Help with Minecraft modding (Java Edition)
So one of my custom entities has attack knockback of 12. This was inspired by those anime moments where a character is knocked into a wall with force so great, it damages the wall. However, I don't know how I am going to be able to do this. What I want is the specific mob's knockback to break blocks. However, I don't want it to break really hard blocks like obsidian or bedrock. I'd say the limit is stones and ores. How can I do this?
Try Creating A Procedure "when entity is hurt"
I Tried To Make A Small Procedure For You, Just See If It Works:
https://www.dropbox.com/s/io34kbo55z7ga78/help1.ptpl?dl=0
Or Use This Image:
https://imgur.com/a/vz3WMBK
I came up with a concept; Testing for the velocity of any entity with an X velocity of 10 or greater, if this is the case, then test for the block in front and break the block if the block is dirt (twice for both head and feet positions).
Is this what you had in mind?
Close, but not too close, I made it explode and not explode obsidian and bedrock, and I didn't add "remove block" or "velocity". I don't know if you need that, but try it if you want to
One issue I see with Professor Blue's procedure is when it is executed: Exploding when the entity is not encased in obsidian or bedrock whenever the entity takes damage. However, all blocks have already a variable that show how resistant they are to explosions, obsidian only vulnerable to Wither explosions and bedrock being invulnerable. So perhaps using an explosion is better than using whatever that Remove block code block is!
In the end we will still need to test for the entities' velocity to filter out executing situations. (It would be neat to fall from 200 blocks up and land in a crater too, not only from attack knockback)
I have created another procedure with this, it works in all directions as well, but requires a lot of Get Block code blocks to make sure the entity is not exploding while flying through the air:
Sounds good. Think you can make me the complete procedure?
I do not know how to share files through MCreator forms, everything needed for the procedure should be in the photo already. All 10 Get Block code blocks had been compressed into that single block so the screen photo would be easier to take.
If Get block at x: x+1 y: y z: z OR
Get block at x: x-1 y: y z: z OR
Get block at x: x y: y z: z+1 OR
Get block at x: x y: y z: z-1 OR
Get block at x: x y: y-1 z: z OR
Get block at x: x y: y+2 z: z OR
Get block at x: x+1 y: y+1 z: z OR
Get block at x: x-1 y: y+1 z: z OR
Get block at x: x y: y+1 z: z+1 OR
Get block at x: x y: y+1 z: z-1