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

Migats

Members
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Migats's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. It works. The mistake that I made in the first place, is that I didn't know what player instance needs to revive its capabilities. The method is called after the new player is created and so the old player needs to have the capabilities revived and not the new one. It makes a lot of sense now that I understand it.
  2. I still don't get what is going on. The assignStatsOnClone method is modifying the attributes, but I couldn't find a reference to the capabilities itself. I tried a not so needly code by getting both capabilities and using a variable. It doesn't work. For some reason the capabilities are declared as invalidated during the PlayerEvent.Clone, and I can't figure out how to fix that.
  3. Thanks @Zanckor for your reply. It turns out I still needed a CapabilityProvider to provide an instance of the capability. I don't really know why this has to be a LazyOptional, but it works as long as I keep my checking code in the IfPresent method. However, I want the data to remain after a player dies. Inside the forge documentations they already pointed out to do it using the PlayerEvent$Clone event, but I still don't get enough context. Is there a needly way to copy the data over to the respawned player.
  4. The only thing I want is to save a custom number on the player. The only way that I can think of that works is by using capabilities. The only problem is that I don't know how they work. I took a look at the EnergyStorage class to see what things I need. The things that I have is an interface to store the data, a class that implements that interface and INBTSerializable, and a class to register the capability, just like in EnergyStorage. But I still don't understand what classes I'm missing to attach it to the player. Anyone can help?
  5. I've found it already. I can just override the getLocalizedDeathMessage method. This is what triggers the DamageSource class to send a translatable death message, and I can just return my own.
  6. I'm trying to make a custom death message in my mod. I made my own DamageSource for this thing. However, I have one problem. The DamageSource requires a translation key and my mod is meaned to be runned on a server with vanilla clients. So is there any way to change the death message to a literal death message?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.