Blocking specific type of damage

Started by Toma400 on

Topic category: Help with modding (Java Edition)

Blocking specific type of damage

Hello again,

For my newest mod update I promised myself to do as much bugfixes and polishing as possible, and this made me realise that two problems I struggle with, are in fact really similar. Shortly describing:

1) I have ingot and block that I want to preserve from being destroyed by *anything* (except End void), while in entity form. So, if you drop it into a cactus, it will stay forever, the same for lava, explosions and all other jazz. Something like nether star mixed with netherite. I thought adding "protection V" to it will work, but this commands seems not work for item entities (or it just works too slow? or I wrote something wrong?)

2) I want to make sabre defence mode, so when you right-click with it, it gives you protection from enemy's attacks, just like shield. I already did that, giving effect "protection V" to player, but after that I realised it also blocks all kinds of damage. And I want player to be still vulnerable for fire, explosions, cacti and any other "non-attack" damage. Without that this weapon will be too OP.

If that helps, I still use MCreator 2020.3.
Thanks in advance! ^^