Exponential Experience Gain
roobscoob opened this issue ยท 2 comments
In my testing it seems that this function runs not only when you pick up an EXP orb, but also when you fail to pick up an exp orb.
In minecraft you can only pick up 1 exp orb every 2 ticks. This function seems to be called not only when the orb is collected, but when the orb FAILS to collect (due to the rate limit)
if a player stands around a pool of experience, this will lead the oldest particles to exponentially grow. this can cause players to gain 100s of levels of experience VERY quickly.
Example video of issue: https://drive.google.com/file/d/1MC1IUltJ5x3mT32hwG5_8ezVGW8F5ILq/view?usp=sharing
My recommendation would be either to change the name of the helper to OnExpOrbTouched, or In your library check to make sure the experiencePickUpDelay
is 0
Hello, OnExperiencePickedUp is called only when the delay is equal to 0 https://github.com/Majrusz/MajruszLibrary/blob/1.20.X/common/src/main/java/com/mlib/mixin/MixinExperienceOrb.java#L25. The inject is before take
method:
public void playerTouch(Player $$0) {
if (!this.level().isClientSide) {
if ($$0.takeXpDelay == 0) {
$$0.takeXpDelay = 2;
// <-- code was injected here
$$0.take(this, 1);
int $$1 = this.repairPlayerItems($$0, this.value);
if ($$1 > 0) {
$$0.giveExperiencePoints($$1);
}
--this.count;
if (this.count == 0) {
this.discard();
}
}
}
}
However you are right, there was a bug that exponentially increased the experience that I fixed here Majrusz/MajruszLibrary@cad9a82. Anyway, thanks for the report!