@@ -31,11 +31,13 @@ import gg.skytils.skytilsmod.core.tickTimer
3131import gg.skytils.skytilsmod.events.impl.*
3232import gg.skytils.skytilsmod.events.impl.GuiContainerEvent.SlotClickEvent
3333import gg.skytils.skytilsmod.events.impl.PacketEvent.ReceiveEvent
34+ import gg.skytils.skytilsmod.features.impl.dungeons.cataclysmicmap.handlers.DungeonInfo
3435import gg.skytils.skytilsmod.mixins.transformers.accessors.AccessorEntityArmorstand
3536import gg.skytils.skytilsmod.mixins.transformers.accessors.AccessorWorldInfo
3637import gg.skytils.skytilsmod.utils.*
3738import gg.skytils.skytilsmod.utils.ItemUtil.getExtraAttributes
3839import gg.skytils.skytilsmod.utils.ItemUtil.getSkyBlockItemID
40+ import gg.skytils.skytilsmod.utils.ItemUtil.setLore
3941import gg.skytils.skytilsmod.utils.NumberUtil.romanToDecimal
4042import gg.skytils.skytilsmod.utils.NumberUtil.roundToPrecision
4143import gg.skytils.skytilsmod.utils.RenderUtil.highlight
@@ -78,6 +80,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent
7880import net.minecraftforge.event.entity.EntityJoinWorldEvent
7981import net.minecraftforge.event.entity.living.EnderTeleportEvent
8082import net.minecraftforge.event.entity.player.ItemTooltipEvent
83+ import net.minecraftforge.event.world.WorldEvent
8184import net.minecraftforge.fml.common.Loader
8285import net.minecraftforge.fml.common.eventhandler.Event
8386import net.minecraftforge.fml.common.eventhandler.EventPriority
@@ -450,6 +453,8 @@ object MiscFeatures {
450453 }
451454 }
452455
456+ private var fakeDungeonMap: ItemStack ? = null
457+
453458 @SubscribeEvent
454459 fun onTick (event : TickEvent .ClientTickEvent ) {
455460 if (! Utils .inSkyblock || event.phase != TickEvent .Phase .START || mc.thePlayer == null || mc.theWorld == null ) return
@@ -466,6 +471,27 @@ object MiscFeatures {
466471 }
467472 }
468473 }
474+ (DungeonInfo .dungeonMap ? : DungeonInfo .guessMapData)?.let {
475+ val itemInSlot = mc.thePlayer?.inventory?.getStackInSlot(8 )?.item
476+ if (Skytils .config.injectFakeDungeonMap && itemInSlot != Items .filled_map && itemInSlot != Items .arrow) {
477+ if (fakeDungeonMap == null ) {
478+ val guessMapId = it.mapName.substringAfter(" map_" ).toIntOrNull()
479+ if (guessMapId == null ) {
480+ mc.theWorld.setItemData(" map_-1337" , it)
481+ }
482+ fakeDungeonMap = ItemStack (Items .filled_map, 1337 , guessMapId ? : - 1337 ).also {
483+ it.setStackDisplayName(" §bMagical Map" )
484+ it.setLore(listOf (" §7Shows the layout of the Dungeon as" , " §7it is explored and completed." , " " , " §cThis isn't the real map! Skytils injected this data in for you." ))
485+ }
486+ }
487+ mc.thePlayer.inventory.setInventorySlotContents(8 , fakeDungeonMap)
488+ }
489+ }
490+ }
491+
492+ @SubscribeEvent
493+ fun onWorldLoad (event : WorldEvent .Unload ) {
494+ fakeDungeonMap = null
469495 }
470496
471497 @SubscribeEvent
0 commit comments