Skip to content

Commit

Permalink
feature: add option enable_back_on_death and enable_back_on_teleport
Browse files Browse the repository at this point in the history
  • Loading branch information
sakurawald committed Jan 8, 2025
1 parent 468ed77 commit 2169ed8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

public class BackConfigModel {
public double ignore_distance = 32d;
public boolean enable_back_on_death = true;
public boolean enable_back_on_teleport = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ public abstract class ServerPlayerEntityMixin {

@Inject(method = "onDeath", at = @At("HEAD"))
public void saveCurPos(DamageSource damageSource, CallbackInfo ci) {
BackInitializer.saveCurrentPosition(player);
if (BackInitializer.config.model().enable_back_on_death) {
BackInitializer.saveCurrentPosition(player);
}
}

@Inject(method = "teleport", at = @At("HEAD"))
public void saveCurPos(ServerWorld serverWorld, double d, double e, double f, Set<PositionFlag> set, float g, float h, boolean bl, CallbackInfoReturnable<Boolean> cir) {
BackInitializer.saveCurrentPosition(player);
if (BackInitializer.config.model().enable_back_on_teleport) {
BackInitializer.saveCurrentPosition(player);
}
}

}

0 comments on commit 2169ed8

Please sign in to comment.