Skip to content

Commit 142a4c5

Browse files
fix: stop injecting fake dungeon map in boss room
also moves the feature to dungeons category
1 parent ec1122b commit 142a4c5

File tree

3 files changed

+31
-32
lines changed

3 files changed

+31
-32
lines changed

src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ object Config : Vigilant(
180180
)
181181
var updateChannel = 2
182182

183+
@Property(
184+
type = PropertyType.SWITCH, name = "Inject Fake Dungeon Map",
185+
description = "Injects a fake Magical Map into your hotbar to make old mods work again!\nP.S.: Use Cataclysmic Map!",
186+
category = "Dungeons", subcategory = "Fixes"
187+
)
188+
var injectFakeDungeonMap = false
189+
183190
@Property(
184191
type = PropertyType.SWITCH, name = "Dungeon Crypts Counter",
185192
description = "Shows the amount of crypts destroyed on your HUD.",
@@ -1420,13 +1427,6 @@ object Config : Vigilant(
14201427
)
14211428
var bossBarFix = false
14221429

1423-
@Property(
1424-
type = PropertyType.SWITCH, name = "Inject Fake Dungeon Map",
1425-
description = "Injects a fake Magical Map into your hotbar to make old mods work again!\nP.S.: Use Cataclysmic Map!",
1426-
category = "Miscellaneous", subcategory = "Fixes"
1427-
)
1428-
var injectFakeDungeonMap = false
1429-
14301430
@Property(
14311431
type = PropertyType.SWITCH, name = "Fix Falling Sand Rendering",
14321432
description = "Adds a check to rendering in order to prevent crashes.",

src/main/kotlin/gg/skytils/skytilsmod/features/impl/dungeons/DungeonFeatures.kt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ import gg.skytils.skytilsmod.core.structure.GuiElement
2828
import gg.skytils.skytilsmod.events.impl.*
2929
import gg.skytils.skytilsmod.events.impl.GuiContainerEvent.SlotClickEvent
3030
import gg.skytils.skytilsmod.events.impl.PacketEvent.ReceiveEvent
31+
import gg.skytils.skytilsmod.features.impl.dungeons.cataclysmicmap.handlers.DungeonInfo
3132
import gg.skytils.skytilsmod.features.impl.handlers.MayorInfo
3233
import gg.skytils.skytilsmod.listeners.DungeonListener
3334
import gg.skytils.skytilsmod.mixins.transformers.accessors.AccessorEnumDyeColor
3435
import gg.skytils.skytilsmod.utils.*
36+
import gg.skytils.skytilsmod.utils.ItemUtil.setLore
3537
import gg.skytils.skytilsmod.utils.Utils.equalsOneOf
3638
import gg.skytils.skytilsmod.utils.graphics.ScreenRenderer
3739
import gg.skytils.skytilsmod.utils.graphics.SmartFontRenderer.TextAlignment
@@ -57,6 +59,7 @@ import net.minecraft.init.Items
5759
import net.minecraft.inventory.ContainerChest
5860
import net.minecraft.item.EnumDyeColor
5961
import net.minecraft.item.ItemSkull
62+
import net.minecraft.item.ItemStack
6063
import net.minecraft.network.play.server.*
6164
import net.minecraft.potion.Potion
6265
import net.minecraft.util.AxisAlignedBB
@@ -177,6 +180,8 @@ object DungeonFeatures {
177180
}
178181
}
179182

183+
private var fakeDungeonMap: ItemStack? = null
184+
180185
@SubscribeEvent
181186
fun onTick(event: ClientTickEvent) {
182187
if (event.phase != TickEvent.Phase.START || mc.thePlayer == null || mc.theWorld == null) return
@@ -309,6 +314,24 @@ object DungeonFeatures {
309314
}
310315
}
311316
}
317+
if (Skytils.config.injectFakeDungeonMap && DungeonTimer.bossEntryTime != -1L) {
318+
(DungeonInfo.dungeonMap ?: DungeonInfo.guessMapData)?.let {
319+
val itemInSlot = mc.thePlayer?.inventory?.getStackInSlot(8)?.item
320+
if (itemInSlot != Items.filled_map && itemInSlot != Items.arrow) {
321+
if (fakeDungeonMap == null) {
322+
val guessMapId = it.mapName.substringAfter("map_").toIntOrNull()
323+
if (guessMapId == null) {
324+
mc.theWorld.setItemData("map_-1337", it)
325+
}
326+
fakeDungeonMap = ItemStack(Items.filled_map, 1337, guessMapId ?: -1337).also {
327+
it.setStackDisplayName("§bMagical Map")
328+
it.setLore(listOf("§7Shows the layout of the Dungeon as", "§7it is explored and completed.", "", "§cThis isn't the real map!", "§eSkytils injected this data in for you."))
329+
}
330+
}
331+
mc.thePlayer.inventory.setInventorySlotContents(8, fakeDungeonMap)
332+
}
333+
}
334+
}
312335
}
313336
}
314337

@@ -740,6 +763,7 @@ object DungeonFeatures {
740763
blazes = 0
741764
hasClearedText = false
742765
terracottaSpawns.clear()
766+
fakeDungeonMap = null
743767
}
744768

745769
class SpiritBearSpawnTimer : GuiElement("Spirit Bear Spawn Timer", x = 0.05f, y = 0.4f) {

src/main/kotlin/gg/skytils/skytilsmod/features/impl/misc/MiscFeatures.kt

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ import gg.skytils.skytilsmod.core.tickTimer
3131
import gg.skytils.skytilsmod.events.impl.*
3232
import gg.skytils.skytilsmod.events.impl.GuiContainerEvent.SlotClickEvent
3333
import gg.skytils.skytilsmod.events.impl.PacketEvent.ReceiveEvent
34-
import gg.skytils.skytilsmod.features.impl.dungeons.cataclysmicmap.handlers.DungeonInfo
3534
import gg.skytils.skytilsmod.mixins.transformers.accessors.AccessorEntityArmorstand
3635
import gg.skytils.skytilsmod.mixins.transformers.accessors.AccessorWorldInfo
3736
import gg.skytils.skytilsmod.utils.*
3837
import gg.skytils.skytilsmod.utils.ItemUtil.getExtraAttributes
3938
import gg.skytils.skytilsmod.utils.ItemUtil.getSkyBlockItemID
40-
import gg.skytils.skytilsmod.utils.ItemUtil.setLore
4139
import gg.skytils.skytilsmod.utils.NumberUtil.romanToDecimal
4240
import gg.skytils.skytilsmod.utils.NumberUtil.roundToPrecision
4341
import gg.skytils.skytilsmod.utils.RenderUtil.highlight
@@ -453,8 +451,6 @@ object MiscFeatures {
453451
}
454452
}
455453

456-
private var fakeDungeonMap: ItemStack? = null
457-
458454
@SubscribeEvent
459455
fun onTick(event: TickEvent.ClientTickEvent) {
460456
if (!Utils.inSkyblock || event.phase != TickEvent.Phase.START || mc.thePlayer == null || mc.theWorld == null) return
@@ -471,27 +467,6 @@ object MiscFeatures {
471467
}
472468
}
473469
}
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
495470
}
496471

497472
@SubscribeEvent

0 commit comments

Comments
 (0)