I have an idea for a mod where it's impossible for someone to die. they cannot be killed by anything apart from a certain weapon, surrounded by a certain block on a full moon. There would be a drawback to the mod that every time they reach a point where they lose all their hearts they gain negative traits, like slowness, weakness, and others. so the only way to kill them is to be killed by a weapon that isn't easy to obtain with other circumstances so that if it is implemented into a server somebody isn't completely unstoppable. another thing that could be added is some creature that is able to kill you but is rare just so if they somehow become immortal in single player that can still be threatened. how to become immortal is through drinking a potion and once they've drunk it they cannot become mortal unless they are killed by the item
Explanation on why this is the case:
The gist of the mod's most powerful armor is... Nothing can kill you as long as you have the infinity armor on. Nothing at all. I believe it does this by doing a @SubscribeEvent on an entity death event or player death event. It checks if they are wearing the full set, and if so the event is canceled or player health is set to full. It also does the same thing for damage, preventing the damage from being dealt.
For someone modding this:
You'll need to use a capability provider on the player to give them the immortality tag, and do some checks when the sword to kill them hits them and then check if they are surrounded by the block of your choice using their block position and a level data accessor. If so, remove their immortality tag and fire the death event. If they don't have an immortality tag when the player death event is fired, do nothing. If they do, cancel the event however possible.
I have an idea for a mod where it's impossible for someone to die. they cannot be killed by anything apart from a certain weapon, surrounded by a certain block on a full moon. There would be a drawback to the mod that every time they reach a point where they lose all their hearts they gain negative traits, like slowness, weakness, and others. so the only way to kill them is to be killed by a weapon that isn't easy to obtain with other circumstances so that if it is implemented into a server somebody isn't completely unstoppable. another thing that could be added is some creature that is able to kill you but is rare just so if they somehow become immortal in single player that can still be threatened. how to become immortal is through drinking a potion and once they've drunk it they cannot become mortal unless they are killed by the item
For any fellow modder looking at this and thinking, "Nah this is impossible!" look at the mod Avaritia (https://www.curseforge.com/minecraft/mc-mods/avaritia-1-10).
Explanation on why this is the case:
The gist of the mod's most powerful armor is... Nothing can kill you as long as you have the infinity armor on. Nothing at all. I believe it does this by doing a @SubscribeEvent on an entity death event or player death event. It checks if they are wearing the full set, and if so the event is canceled or player health is set to full. It also does the same thing for damage, preventing the damage from being dealt.
For someone modding this:
You'll need to use a capability provider on the player to give them the immortality tag, and do some checks when the sword to kill them hits them and then check if they are surrounded by the block of your choice using their block position and a level data accessor. If so, remove their immortality tag and fire the death event. If they don't have an immortality tag when the player death event is fired, do nothing. If they do, cancel the event however possible.