Iron's Spells 'n Spellbooks

Iron's Spells 'n Spellbooks

18M Downloads

Make the compass only show catacombs where the boss has not been killed yet

SiverDX opened this issue ยท 1 comments

commented

Feature description

on kill store the location in here (you can check if the boss is inside a catacomb structure)

// Keep track of listed catacombs in here
DimensionDataStorage storage = serverLevel.getDataStorage();

Have a custom way to locate the structure (to skip completed ones)

BlockPos blockpos = serverlevel.findNearestMapStructure(ModTags.WAYWARD_COMPASS_LOCATOR, pPlayer.blockPosition(), 100, false);

or do a mixin to one of the methods responsible, e.g. ChunkGenerator#getStructureGeneratingAt:

   @Nullable
   private static Pair<BlockPos, Holder<Structure>> getStructureGeneratingAt(Set<Holder<Structure>> pStructureHoldersSet, LevelReader pLevel, StructureManager pStructureManager, boolean pSkipKnownStructures, StructurePlacement pPlacement, ChunkPos pChunkPos) {
      for(Holder<Structure> holder : pStructureHoldersSet) {
         // Set this to `START_NOT_PRESENT` if the structure is a catacomb and close to an entry of the known completed ones
         // (Unless it already has that value)
         StructureCheckResult structurecheckresult = pStructureManager.checkStructurePresence(pChunkPos, holder.value(), pSkipKnownStructures);
         if (structurecheckresult != StructureCheckResult.START_NOT_PRESENT) {
            if (!pSkipKnownStructures && structurecheckresult == StructureCheckResult.START_PRESENT) {
               return Pair.of(pPlacement.getLocatePos(pChunkPos), holder);
            }

            ChunkAccess chunkaccess = pLevel.getChunk(pChunkPos.x, pChunkPos.z, ChunkStatus.STRUCTURE_STARTS);
            StructureStart structurestart = pStructureManager.getStartForStructure(SectionPos.bottomOf(chunkaccess), holder.value(), chunkaccess);
            if (structurestart != null && structurestart.isValid() && (!pSkipKnownStructures || tryAddReference(pStructureManager, structurestart))) {
               return Pair.of(pPlacement.getLocatePos(structurestart.getChunkPos()), holder);
            }
         }
      }

      return null;
   }

How it improves the player experience

you wouldn't have to travel an unknown amount of blocks and keep re-crafting the compass to find new catacombs

commented

the skipKnownStructures flag wouldn't work for a pre-generated world I think
(as in, they would be considered as known even if never visited)