Respawn Obelisks

Respawn Obelisks

7.6k Downloads

[BUG] secondarySpawnMode IF_OBELISK does not function correctly.

Nereithr opened this issue ยท 6 comments

commented

Describe the bug
IF_OBELISK does not prevent selecting a secondary spawn point when your last respawn point is NOT an obelisk.

To Reproduce
Steps to reproduce the behavior:

  1. Set secondarySpawnMode to IF_OBELISK
  2. Set spawn a couple of times, prioritize something that is NOT an obelisk.
  3. /kill. You will be able to select any secondary spawn point even if your last selected spawn point was NOT an obelisk.

Expected behavior
IF_OBELISK prevents selecting a secondary spawn point unless your last spawn point is an OBELISK

Notes
Did not test with worldSpawnMode. IF_CHARGED works properly, it's just IF_OBELISK that appears to be broken.

Versions

  • Respawn Obelisk Version: 2.5-c
  • Forge Version (if forge): Both NeoForge 47.1.106 and Forge 47.3.0
  • Architectury 9.2.14

Additional notes

There is an additional problem with the overall max respawn points, filing that as a separate issue.

commented

Welp, guess I forgot to add them there lol.

commented

Oh no, the priority does appear to be set up properly (you spawn on the obelisk and everything), plus everything works with IF_CHARGED.

My guess is just that the cases for IF_OBELISK and UNLESS_OBELISK are not yet implemented in SecondarySpawnPointConfig.java while the recommended enums are already present in the config, so it defaults to the ALWAYS/default scenario:

public boolean evaluate(SpawnPoint point, ServerPlayerEntity player) {
            return switch (this) {
                case IF_CHARGED -> point != null && player.getServer().getWorld(point.dimension()).getBlockEntity(point.pos()) instanceof RespawnObeliskBlockEntity robe && robe.getCharge(player)-robe.getCost(player) >= 0;
                case UNLESS_CHARGED_OBELISK -> point == null || !(player.getServer().getWorld(point.dimension()).getBlockEntity(point.pos()) instanceof RespawnObeliskBlockEntity robe) || robe.getCharge(player)-robe.getCost(player) < 0;
                case UNLESS_CHARGED -> point != null && player.getServer().getWorld(point.dimension()).getBlockEntity(point.pos()) instanceof RespawnObeliskBlockEntity robe && robe.getCharge(player)-robe.getCost(player) < 0;
                case NEVER -> false;
                default -> true;
            };
        }
commented

Do you have the config option enabled that forces specific blocks to always be higher in priority than others?

commented

Do you have the config option enabled that forces specific blocks to always be higher in priority than others?

No, these are the settings I'm using in the secondary spawn section (secondary spawn mode notwithstanding, since that is the topic). Also, this does even if worldSpawnMode is set to "NEVER".

"secondarySpawnPoints": {
        // Whether secondary spawn points should be enabled. Secondary respawn points can be used to have multiple respawn points, triggered at various times.
        "enableSecondarySpawnPoints": true,
        // Determines the overall maximum amount of secondary respawn points you can have. -1 is infinite.
        "overallMaxPoints": 2,
        /*
        Determines a per-block cap on the amount of respawn points you can have. -1 is infinite.
        Tags(which get treated as a single entry) are supported by beginning the entry with a #.
        Example: {"#minecraft:beds": 5, "respawnobelisks:respawn_obelisk": 5} // this would allow you to have 5 bed respawn points and 5 obelisk respawn points
        */
        "maxPointsPerBlock": {
            "#minecraft:beds": 1,
            "respawnobelisks:respawn_obelisk": 1
        },
        // Determines the maximum amount of secondary respawn points you can have at any block not specified in 'maxPointsPerBlock'. -1 is infinite.
        "defaultMaxPoints": 1,
        // Whether players can forcefully change the order of their secondary respawn points by shift right clicking a respawn point.
        "allowPriorityShifting": false,
        // Whether blocks should be given a specific order for respawning. This will not work well with 'allowPriorityShifting.'
        "enableBlockPriorities": false,
        /*
        Determines a per-block priority in which to order secondary respawn points. Default value is 0. Higher numbers have higher priority.
        Tags(which get treated as a single entry) are supported by beginning the entry with a #.
        */
        "blockPriorities": {},
        // Whether attempting to set your spawn point when you are unable to overrides an existing spawn point.
        "forceSpawnSetting": true,
        /*
        When players are allowed to choose to spawn at a secondary respawn point.
        NEVER: Players can never choose.
        ALWAYS: Players can always choose.
        IF_CHARGED: Players can only choose if their respawn point is an obelisk that has charge.
        UNLESS_CHARGED: Players can only choose if their respawn point is an obelisk that does not have charge.
        UNLESS_CHARGED_OBELISK: Players can only choose if their obelisk does not have charge, or if their respawn point isn't an obelisk.
        IF_OBELISK: Players can only choose if their respawn point is an obelisk.
        UNLESS_OBELISK: Players can only choose if their respawn point is not an obelisk.
        */
        "secondarySpawnMode": "IF_CHARGED",
        /*
        When players are allowed to choose to respawn at world spawn.
        NEVER: Players can never choose.
        ALWAYS: Players can always choose.
        IF_CHARGED: Players can only choose if their respawn point is an obelisk that has charge.
        UNLESS_CHARGED: Players can only choose if their respawn point is an obelisk that does not have charge.
        UNLESS_CHARGED_OBELISK: Players can only choose if their obelisk does not have charge, or if their respawn point isn't an obelisk.
        IF_OBELISK: Players can only choose if their respawn point is an obelisk.
        UNLESS_OBELISK: Players can only choose if their respawn point is not an obelisk.
        */
        "worldSpawnMode": "ALWAYS"
    }, 
    ```
commented

Alright. I guess I didn't setup so that choosing a respawn point prioritizes it, doing that might have some side effects I'll have to see. Will be fixed next update.

commented

Fixed as of 2.5-d.