Topic category: User side tutorials
This feature is now included in core, custom code is no longer needed
Define the damage source
First, create a procedure and choose the block name deal damage with source, input a number for amount (it would not matter as the code will be changed) and click on GENERIC.
Then, find this line of code:
entity.attackEntityFrom(DamageSource.GENERIC, (float) amount);
and change it to this:
DamageSource source = new DamageSource("sourcename").setDamageBypassesArmor();
You will need to rename source and sourcename yourself
Deal the damage
Below that line, add this:
entity.attackEntityFrom(source,amount);
Change amount to the amount you want the damage to deal (1 heart = 2) and source should be the same as defined above
Now we need to add the translation keys
Head over to localization on the sidebar and click on add localization entry
In the popup input box (Key name), type
death.attack.sourcename
Where sourcename should be the same as defined above
In the localized text field, type:
%1$s whatever you want the death message to be
%1$s will be translated to the player name
So if you typed
%1$s died from MCreator
And the player is Mike, the death message will be "Mike died from MCreator"
Heads Up! You will also need to add a second death message that appears when the player has been attacked by another entity in the last few seconds before death:
Example:
%1$s died from diabetes whilst fighting %2$s
Nice!
thanks!
hehe the ticket is postponed
does sit work with potions effects?
YES!
I love this, I can use this in my mods!! Thank you Shocking Artist!
Great! this will help me a lot! Thank you Shocking Artist!
I think Klemen could add this feature sooner that he thinks :)
I have a schedule of things to add, I am amazed how after all this time I still have to repeat this.
There are over 100 tickets open here, and a few 100 in my internal TODO backlog. Give me some slack, lol.
I believe you could understand the problem is not in one ticket, but the fact there are many of them and I can only work one by one...
yeah
just some people thinks sometimes you dont add a feature early because you dont know to code it yet XD
Now you know the real reason, I hope I won't have to explain it to you again next week
"next week"? 🤔
Klemen has things to do, that's why I made the tutorial
Klemen, Don't add this in Mcreator, so as to keep some mods unique