[BUG] Incompatible with the "Recall" spell from Iron's Spellbooks
Quarkrus opened this issue ยท 1 comments
Describe the bug
The spell should teleport player to the last spawn point, but it forcibly teleports to the world spawn point and writes about the absence of any respawn points.
To Reproduce
Steps to reproduce the behavior:
- Activate the obelisk
- Find the Recall Scroll
- Use it from your hands or from a any spellbook
- See error
Versions
- Minecraft (1.20.1)
- Respawn Obelisk (2.6-b)
- Forge (47.2.20)
- Iron's Spellbooks (3.4.0)
This is on ISS's side, they use their own "findRespawnPoint" function instead of using the one provided by vanilla: (RecallSpell.java)
/**
* Adapted from vanilla {@link Player#findRespawnPositionAndUseSpawnBlock(ServerLevel, BlockPos, float, boolean, boolean)}
*/
public static Optional<Vec3> findSpawnPosition(ServerLevel level, ServerPlayer player) {
BlockPos spawnBlockpos = player.getRespawnPosition();
if (spawnBlockpos == null) {
return Optional.empty();
}
BlockState blockstate = level.getBlockState(spawnBlockpos);
Block block = blockstate.getBlock();
if (block instanceof RespawnAnchorBlock && blockstate.getValue(RespawnAnchorBlock.CHARGE) > 0 && RespawnAnchorBlock.canSetSpawn(level)) {
//IronsSpellbooks.LOGGER.debug("RecallSpell.findSpawnPosition.respawnAnchor");
return RespawnAnchorBlock.findStandUpPosition(EntityType.PLAYER, level, spawnBlockpos);
} else if (block instanceof BedBlock && BedBlock.canSetSpawn(level)) {
//IronsSpellbooks.LOGGER.debug("RecallSpell.findSpawnPosition.bed");
return BedBlock.findStandUpPosition(EntityType.PLAYER, level, spawnBlockpos, player.getDirection(), player.getYRot());
} else {
return Optional.empty();
// boolean flag = block.isPossibleToRespawnInThis();
// boolean flag1 = level.getBlockState(spawnBlockpos.above()).getBlock().isPossibleToRespawnInThis();
// return flag && flag1 ? Optional.of(new Vec3((double)spawnBlockpos.getX() + 0.5D, (double)spawnBlockpos.getY() + 0.1D, (double)spawnBlockpos.getZ() + 0.5D)) : Optional.empty();
}
}
(even if you can't read java, it's more of just a pointer) As you can see, at the top it says "Adapted from vanilla {@link Player#findRespawnPositionAndUseSpawnBlock..." I specifically mixin to the "findRespawnPositionAndUseSpawnBlock" method and that's where all my logic is done. That's where other mods will put in their logic, and that's the method ISS should be using. I'm not sure why they need to use their own, but this is more on their side to fix than mine.
Feel free to reopen if needed.