Origins (Forge)

Origins (Forge)

7M Downloads

[1.18.2] Blazeborn origin can't reset spawn point

StarsDeath2938 opened this issue ยท 3 comments

commented

Obviously, I'm weak in English meanwhile I'm new in minecraft modding.

While i got death in game, I found that the blazeborn origin tried to re-spawn at the center point in Nether, which i spawned at first time i enter the game.

I found the nether_spawn related Code like this:

/src/main/java/io/github/apace100/origins/mixin/forge/ModifyPlayerSpawnPowerMixin.java

@Override
public void onChosen(ModifyPlayerSpawnConfiguration configuration, Entity living, boolean isOrb) {
	if (!isOrb) //This is IMO a better way to do this.
		this.teleportToModifiedSpawn(configuration, living);
}

And I also found related code snippet implement the same functionality on orignal Fabric Part:

/src/main/java/io/github/apace100/origins/power/ModifyPlayerSpawnPower.java

@Override
public void onChosen(boolean isOrbOfOrigin) {
    if(player instanceof ServerPlayerEntity) {
        ServerPlayerEntity serverPlayer = (ServerPlayerEntity)player;
        Pair<ServerWorld, BlockPos> spawn = getSpawn(false);
        if(spawn != null) { 
            if(!isOrbOfOrigin) {
                Vec3d tpPos = Dismounting.method_30769(EntityType.PLAYER, spawn.getLeft(), spawn.getRight(), true);
                if(tpPos != null) {
                    serverPlayer.teleport(spawn.getLeft(), tpPos.x, tpPos.y, tpPos.z, player.pitch, player.yaw);
                } else {
                    serverPlayer.teleport(spawn.getLeft(), spawn.getRight().getX(), spawn.getRight().getY(), spawn.getRight().getZ(), player.pitch, player.yaw);
                    Origins.LOGGER.warn("Could not spawn player with `ModifySpawnPower` at the desired location.");
                }
            }
        }
    }
}

It seems Forge Port missed to check if player's spawn point:
Pair<ServerWorld, BlockPos> spawn = getSpawn(false);
if(spawn != null) { ... }

It's a delight if this bug would be fixed, thanks for your Efforts.

commented

same here. even using commands to set spawn are overwritten by the blazeborn which is really annoying and massively limits where I can set up a base as one.

commented

While I tried to fix this issue by my self, I found these related code already exist in apoli mod.
Seems my mod did not loaded currently.

commented

Finally I found that configuration.getSpawn Always return Initial Spawn Point.
It Seems return value of tpPos shouldn't be static.

I tried to fix this roughly by get serverPlayer.getSpawnPosition, but I think the relate code in apoli Api might require fixed.