Skip to content

Commit

Permalink
check if the EC respawner actually wants to EC spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
arnokeesman committed Jun 18, 2024
1 parent 8afd3ec commit f919b83
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,24 @@ public void onPlayerConnect(ClientConnection connection, ServerPlayerEntity play
)
public ServerWorld onPlayerConnect_firstConnect_spawnPositionOverride(
ServerWorld original,
@Local(ordinal = 0) ServerPlayerEntity player,
@Local(ordinal = 0, argsOnly = true) ServerPlayerEntity player,
@Local(ordinal = 0) NbtCompound playerNbt
) {
if (playerNbt != null) {
// player data existed, definitely isn't first join
return original;
}

MinecraftLocation[] location = new MinecraftLocation[1];
PlayerDataManager.handleRespawnAtEcSpawn(null, (spawnPos) -> {
location[0] = spawnPos;
});

if (location[0] == null) {
// EC respawner doesn't want the player on EC spawn
return original;
}

player.setPosition(location[0].pos());
return original.getServer().getWorld(location[0].dim());
}
Expand Down Expand Up @@ -104,7 +111,7 @@ public void onRespawnPlayer(
))
public void onRespawnPlayer_forResawnLocationOverwrite(
CallbackInfoReturnable<ServerPlayerEntity> cir
, @Local(ordinal = 0) ServerPlayerEntity oldServerPlayerEntity
, @Local(ordinal = 0, argsOnly = true) ServerPlayerEntity oldServerPlayerEntity
, @Local(ordinal = 0) LocalRef<BlockPos> playerSpawnpointBlockPos
, @Local(ordinal = 0) LocalRef<Optional<Vec3d>> respawnPosition
, @Local(ordinal = 1) LocalRef<ServerWorld> serverWorld2
Expand All @@ -124,7 +131,7 @@ public void onRespawnPlayer_forResawnLocationOverwrite(
))
public void onRespawnPlayer_afterSetPosition(
CallbackInfoReturnable<ServerPlayerEntity> cir
, @Local(ordinal = 0) ServerPlayerEntity oldServerPlayerEntity
, @Local(ordinal = 0, argsOnly = true) ServerPlayerEntity oldServerPlayerEntity
, @Local(ordinal = 1) ServerPlayerEntity serverPlayerEntity
) {
PlayerDataManager.handleRespawnAtEcSpawn(oldServerPlayerEntity, (spawnLoc) -> {
Expand Down

0 comments on commit f919b83

Please sign in to comment.