Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Solved] Custom death messages for pets


Recommended Posts

I have a cat, that I can shear for cat hair. (don't question my sanity). But I want a custom death message for the cat when it dies due to over-shearing. How could I override the original message? Also, as a bonus question: how can I disable the cat from sitting/standing. Any method from getAISit doesn't seem to work. resetTask partially works, but not on the first two clicks after summoning the tamed ocelot.

Edited by _Bedrockbreaker_
Added [Solved]

Professional Hot Garbage Programmer.

https://github.com/Bedrockbreaker/

Link to post
Share on other sites
1 minute ago, _Bedrockbreaker_ said:

I have a cat, that I can shear for cat hair. (don't question my sanity). But I want a custom death message for the cat when it dies due to over-shearing. How could I override the original message?

Create a new DamageSource instance, when calling the constructor you can specify a damageType String, set it to something like "mymod.customDamage". Then you can specify the death message by creating the "death.attack.mymod.customDamage" language file entry. It will get the dying entity's name as a parameter. You can additionally specify "death.attack.mymod.customDamage.player", which will be used if the damage was caused by a living entity. This key will receive the dying entity's name and the killer's name as parameters, in that order.

 

7 minutes ago, _Bedrockbreaker_ said:

how can I disable the cat from sitting/standing

Override setSitting to do nothing and override isSitting to always return false. Additionally remove the aiSit task from the taskEntries list in initEntityAI

Link to post
Share on other sites

If you remove the EntityAISit task, the cat will not stand up when you are being attacked.

If you want it to stop following you completely (i.e. it won't teleport to you either while standing) then remove the EntityAIFollowOwner task.

Link to post
Share on other sites

ok, got it. But I can't exactly override a method inside a different method. (subscribed to interact(EntityInteract), and trying to handle everything in there. And I can't exactly get a reference to the entity before the player even clicks on it :P)  *Currently in eclipse at this point forward* So, it seems just putting entityCat.processInteract(player, event.getHand()); { } doesn't give me any errors, but I am going to assume it does somehow because of the ; before the two {}... And I am also going to assume if that is the way to do it, that I need to put something in the braces?

Professional Hot Garbage Programmer.

https://github.com/Bedrockbreaker/

Link to post
Share on other sites

No, I don't have a custom entity, and I don't think creating a new one and replacing all the old ones with mine is the the solution I generally want to do (more like compatibility, than "force to use my cat"). But yes, for any ocelot that I can click on with shears, (which should be every ocelot) I want to disable it from standing/sitting in that right click only. If the player can't harvest more hair, or is not holding shears, the player can normally interact with the ocelot. Is that clear enough? or is more information needed? I just created a github here if you still are confused -> https://github.com/Bedrockbreaker/rtap

Professional Hot Garbage Programmer.

https://github.com/Bedrockbreaker/

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.