How to make a mob vulnerable to only one kind of weapon.

Started by thxlotl on

Topic category: Help with Minecraft modding (Java Edition)

Active 3 years ago
Joined May 2021
Points:
589

User statistics:

  • Modifications: 1
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 5
How to make a mob vulnerable to only one kind of weapon.

I'm making a crab mob for my mod and I was thinking of making it only be able to take direct damage through getting hit by a wooden shovel (because it looks like a mallet)

Active 4 years ago
Joined May 2021
Points:
578

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 33
i dont know if its possable…
Wed, 05/26/2021 - 00:16

i dont know if its possable but you could make it take no damage overall then add a procedure checking if the player attacked it

and had "wooden shovel" in mainhand then deal damage but i dont think this would work with sharpness if for some reason you had that on the shovel

Active 3 years ago
Joined May 2021
Points:
589

User statistics:

  • Modifications: 1
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 5
Thanks I'll try that!
Wed, 05/26/2021 - 01:44

Thanks I'll try that!

Active 4 years ago
Joined May 2021
Points:
578

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 33
if ya run into more issues…
Wed, 05/26/2021 - 14:49

if ya run into more issues you can post a screenshot of the procedure and i can check it out

Active 9 months ago
Joined May 2020
Points:
731

User statistics:

  • Modifications: 3
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 128
Create a procedure "On…
Wed, 05/26/2021 - 15:57

Create a procedure "On entity attacked" and check if the attacked entity is a Crab, and if yes check if the item in main-hand of the attacking entity is a Wooden Shovel. If not, cancel event that triggered global trigger.

Active 9 months ago
Joined May 2020
Points:
731

User statistics:

  • Modifications: 3
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 128
It'll work with Sharpness…
Wed, 05/26/2021 - 16:11

It'll work with Sharpness and other damage changing effects such as Strentgh.

Active 3 years ago
Joined May 2021
Points:
589

User statistics:

  • Modifications: 1
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 5
awesome thanks!
Fri, 06/04/2021 - 01:42

awesome thanks!