Clumps

Clumps

206M Downloads

EXP Data Preservation Events

Darkhax opened this issue ยท 3 comments

commented

Other mods may be storing additional information in the NBT of the experience orb. For these mods it would be nice to have some events or systems in place to allow this data to be copied over to your EXP entity.

  1. EXPCloneEvent - This event would be sent out when you replace the old EXP orb with the Clump version. This would allow mods to subscribe and copy over the data they need.
  2. EXPMergeEvent - This event would be used to handle when two Clumps EXP orbs would merge together. This event would allow for the data to be merged properly, or erased/canceled if the merge is not possible.
commented

I'm curious, how do you think these events should be designed? Should the events just have the old & new entities accessible so you can do as you wish with them, like so?

class EXPCloneEvent {
	private ExperienceOrbEntity vanillaOrb;
	private EntityXPOrbBig newOrb;
}
class EXPMergeEvent {
	private EntityXPOrbBig firstOldOrb;
	private EntityXPOrbBig secondOldOrb;
	private EntityXPOrbBig newOrb;
}

I'd like to pick this issue up, and was wondering if this type of thing would suffice for the use case you mentioned :)

commented

Yes, something along those lines. Im not sure if they make sense in the context of how Clumps actually works though. For example Clumps may just have one merge event which takes a vanilla orb and adds it into their orb type. Rather than explicitly merging 2 vanilla orbs together.

commented

Looking through the code, it looks like whenever an EXP orb is created, it gets transformed into a Clumps orb, and then later, it looks for other nearby Clumps orbs and combines it and one of those nearby into another Clumps orb, so it seems like the system you suggested is the most in line with the way this mod currently works.