Exp reset when exiting end portal
kokobunx opened this issue ยท 1 comments
This issue can be fixed by adding !alive &&
to the beginning of the if-statement on line 54 in ServerPlayerEntityMixin.java. As it is, exiting the end dimension through the Exit Portal runs the same code as if a player died and then checks if XP should be lost on death or not.
Adding a check for if the player is alive or not means the XP-reset won't happen when exiting the End through the Exit Portal (this mirrors how the original game code does it).
@Inject(method = "copyFrom", at = @At("TAIL"))
private void changeXP(ServerPlayerEntity oldPlayer, boolean alive, CallbackInfo ci) {
if (!alive && ConfiguredKeepInventory.Config.enableConfig && ConfiguredKeepInventory.Config.loseXpOnDeath
&& !this.world.getGameRules().getBoolean(GameRules.KEEP_INVENTORY)) {
this.experienceLevel = 0;
this.experienceProgress = 0;
this.totalExperience = 0;
}
}