Skip to content

Commit 8e2ea4f

Browse files
committed
Updated to 1.21.5 and fixed FavoriteAbiContact.kt and FavoritePowerStone.kt not working
1 parent 5bec0f7 commit 8e2ea4f

File tree

10 files changed

+59
-49
lines changed

10 files changed

+59
-49
lines changed

gradle.properties

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
org.gradle.jvmargs=-Xmx4096M
22

3-
yarn_mappings=1.21.4+build.8
4-
53
loom.platform=fabric
6-
7-
mod_version=0.0.1
4+
mod_version=0.1.1
85
maven_group=io.github.frostzie.skyfall
9-
archives_base_name=skyfall
10-
11-
fabric_version=0.114.3+1.21.4
6+
archives_base_name=skyfall

gradle/libs.versions.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[versions]
2-
minecraft = "1.21.4"
3-
yarn_mappings = "1.21.4+build.8"
4-
loader_version = "0.16.10"
5-
fabric_version = "0.119.2+1.21.4"
2+
minecraft = "1.21.5"
3+
yarn_mappings="1.21.5+build.1"
4+
loader_version="0.16.14"
5+
fabric_version="0.125.3+1.21.5"
66
kotlin = "2.1.0"
77
fabric_kotlin = "1.13.3+kotlin.2.1.21"
8-
modmenu = "13.0.3"
8+
modmenu = "14.0.0-rc.2"
99
moulconfig = "3.8.0"
1010
gson = "2.11.0"
1111
devauth = "1.2.1"
@@ -18,11 +18,11 @@ fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "loader_v
1818
fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_version" }
1919
fabric_kotlin = { module = "net.fabricmc:fabric-language-kotlin", version.ref = "fabric_kotlin" }
2020
modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" }
21-
moulconfig = { module = "org.notenoughupdates.moulconfig:modern-1.21.4", version.ref = "moulconfig" }
21+
moulconfig = { module = "org.notenoughupdates.moulconfig:modern-1.21.5", version.ref = "moulconfig" }
2222
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
2323
devauth = { module = "me.djtheredstoner:DevAuth-fabric", version.ref = "devauth" }
2424

2525
[plugins]
2626
kotlin_jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
27-
fabric_loom = { id = "fabric-loom", version = "1.9-SNAPSHOT" }
27+
fabric_loom = { id = "fabric-loom", version = "1.10-SNAPSHOT" }
2828
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME
7-
zipStorePath=wrapper/dists
7+
zipStorePath=wrapper/dists

src/main/kotlin/io/github/frostzie/skyfall/features/inventory/FavoriteAbiContact.kt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.github.frostzie.skyfall.features.inventory
22

3-
import com.google.gson.Gson
3+
import com.google.gson.GsonBuilder
44
import com.google.gson.reflect.TypeToken
55
import io.github.frostzie.skyfall.SkyFall
66
import io.github.frostzie.skyfall.utils.events.SlotRenderEvents
@@ -10,6 +10,7 @@ import net.minecraft.client.gui.DrawContext
1010
import net.minecraft.client.gui.screen.ingame.HandledScreen
1111
import net.minecraft.client.util.InputUtil
1212
import net.minecraft.screen.slot.Slot
13+
import net.minecraft.entity.player.PlayerInventory
1314
import org.lwjgl.glfw.GLFW
1415
import java.awt.Color
1516
import java.io.File
@@ -18,12 +19,10 @@ import java.io.FileWriter
1819

1920
object FavoriteAbiContact {
2021
private val configFile = File("config/skyfall/favorite-contacts.json")
21-
private val gson = Gson()
22+
private val gson = GsonBuilder().setPrettyPrinting().create()
2223
private var keyWasPressed = false
2324
private var highlightedItems = mutableListOf<String>()
2425

25-
private val highlightKey = SkyFall.feature.inventory.abiContact.favoriteKey
26-
2726
private val validSlotRanges = setOf(
2827
10..16,
2928
19..25,
@@ -37,6 +36,7 @@ object FavoriteAbiContact {
3736
ClientTickEvents.END_CLIENT_TICK.register { client ->
3837
val currentScreen = client.currentScreen
3938
if (currentScreen is HandledScreen<*> && isAbiPhoneContacts(currentScreen)) {
39+
val highlightKey = SkyFall.feature.inventory.abiContact.favoriteKey
4040
val window = MinecraftClient.getInstance().window.handle
4141

4242
if (highlightKey != GLFW.GLFW_KEY_UNKNOWN) {
@@ -65,10 +65,18 @@ object FavoriteAbiContact {
6565
return title.contains("Abiphone")
6666
}
6767

68+
fun isSlotInChestInventory(slot: Slot): Boolean {
69+
return slot.inventory !is PlayerInventory
70+
}
71+
6872
private fun handleKeyPress(screen: HandledScreen<*>) {
6973
val hoveredSlot = getHoveredSlot(screen) ?: return
7074
val slotIndex = hoveredSlot.index
7175

76+
if (!isSlotInChestInventory(hoveredSlot)) {
77+
return
78+
}
79+
7280
if (!validSlotRanges.any { slotIndex in it }) {
7381
return
7482
}
@@ -119,6 +127,10 @@ object FavoriteAbiContact {
119127

120128
val slotIndex = slot.index
121129

130+
if (!isSlotInChestInventory(slot)) {
131+
return
132+
}
133+
122134
if (!validSlotRanges.any { slotIndex in it } || slot.stack.isEmpty) {
123135
return
124136
}

src/main/kotlin/io/github/frostzie/skyfall/features/inventory/FavoritePowerStone.kt

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.github.frostzie.skyfall.features.inventory
22

3-
import com.google.gson.Gson
3+
import com.google.gson.GsonBuilder
44
import com.google.gson.reflect.TypeToken
55
import io.github.frostzie.skyfall.SkyFall
66
import io.github.frostzie.skyfall.utils.events.SlotRenderEvents
@@ -9,8 +9,7 @@ import net.minecraft.client.MinecraftClient
99
import net.minecraft.client.gui.DrawContext
1010
import net.minecraft.client.gui.screen.ingame.HandledScreen
1111
import net.minecraft.client.util.InputUtil
12-
import net.minecraft.item.Items
13-
import net.minecraft.screen.GenericContainerScreenHandler
12+
import net.minecraft.entity.player.PlayerInventory
1413
import net.minecraft.screen.slot.Slot
1514
import org.lwjgl.glfw.GLFW
1615
import java.awt.Color
@@ -21,12 +20,10 @@ import kotlin.text.contains
2120

2221
object FavoritePowerStone {
2322
private val configFile = File("config/skyfall/favorite-power-stones.json")
24-
private val gson = Gson()
23+
private val gson = GsonBuilder().setPrettyPrinting().create()
2524
private var keyWasPressed = false
2625
private var highlightedItems = mutableSetOf<String>()
2726

28-
private val highlightKey = SkyFall.feature.inventory.powerStone.favoriteKey
29-
3027
private val validSlotRanges = setOf(
3128
10..16,
3229
19..25,
@@ -40,6 +37,7 @@ object FavoritePowerStone {
4037
ClientTickEvents.END_CLIENT_TICK.register { client ->
4138
val currentScreen = client.currentScreen
4239
if (currentScreen is HandledScreen<*> && isAccessoryBagThaumaturgy(currentScreen)) {
40+
val highlightKey = SkyFall.feature.inventory.powerStone.favoriteKey
4341
val window = MinecraftClient.getInstance().window.handle
4442

4543
if (highlightKey != GLFW.GLFW_KEY_UNKNOWN) {
@@ -65,22 +63,21 @@ object FavoritePowerStone {
6563

6664
private fun isAccessoryBagThaumaturgy(screen: HandledScreen<*>): Boolean {
6765
val title = screen.title.string
68-
if (!title.contains("Accessory Bag Thaumaturgy")) {
69-
return false
70-
}
66+
return title.contains("Accessory Bag Thaumaturgy")
67+
}
7168

72-
val handler = screen.screenHandler
73-
if (handler is GenericContainerScreenHandler && handler.slots.size > 49) {
74-
val slot49 = handler.slots[49]
75-
return slot49.stack.item == Items.BARRIER
76-
}
77-
return false
69+
private fun isSlotInChestInventory(slot: Slot): Boolean {
70+
return slot.inventory !is PlayerInventory
7871
}
7972

8073
private fun handleKeyPress(screen: HandledScreen<*>) {
8174
val hoveredSlot = getHoveredSlot(screen) ?: return
8275
val slotIndex = hoveredSlot.index
8376

77+
if (!FavoriteAbiContact.isSlotInChestInventory(hoveredSlot)) {
78+
return
79+
}
80+
8481
if (!validSlotRanges.any { slotIndex in it }) {
8582
return
8683
}
@@ -131,6 +128,10 @@ object FavoritePowerStone {
131128

132129
val slotIndex = slot.index
133130

131+
if (!FavoriteAbiContact.isSlotInChestInventory(slot)) {
132+
return
133+
}
134+
134135
if (!validSlotRanges.any { slotIndex in it } || slot.stack.isEmpty) {
135136
return
136137
}

src/main/kotlin/io/github/frostzie/skyfall/features/misc/funny/RealisticSpacemanHelmet.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import net.minecraft.client.gui.DrawContext
1111
import net.minecraft.client.render.RenderLayer
1212
import net.minecraft.util.Identifier
1313
import io.github.frostzie.skyfall.utils.item.SkyBlockItemData
14+
import net.minecraft.entity.EquipmentSlot
1415

1516
object RealisticSpacemanHelmet {
1617
private val config get() = SkyFall.feature.miscFeatures.funny.spacemanHelmetConfig
@@ -44,7 +45,7 @@ object RealisticSpacemanHelmet {
4445
private fun isWearing(): Identifier? {
4546
val client = MinecraftClient.getInstance()
4647
val player = client.player ?: return null
47-
val onHead = player.inventory.armor[3]
48+
val onHead = player.getEquippedStack(EquipmentSlot.HEAD)
4849

4950
if (onHead.isEmpty) return null
5051

src/main/kotlin/io/github/frostzie/skyfall/utils/ChatUtils.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package io.github.frostzie.skyfall.utils
22

33
import net.minecraft.client.MinecraftClient
44
import net.minecraft.text.ClickEvent
5-
import net.minecraft.text.HoverEvent
5+
import net.minecraft.text.HoverEvent // Ensure this is the correct import
66
import net.minecraft.text.MutableText
77
import net.minecraft.text.Style
88
import net.minecraft.text.Text
@@ -59,8 +59,9 @@ object ChatUtils {
5959
val styledMessage = Text.literal(errorMessage)
6060
.setStyle(
6161
Style.EMPTY.withColor(TextColor.fromRgb(0xFF5555)) // Light Red
62-
.withClickEvent(ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, copyableText))
63-
.withHoverEvent(HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal("§eClick to copy error message")))
62+
.withClickEvent(ClickEvent.CopyToClipboard(copyableText))
63+
// Corrected HoverEvent instantiation
64+
.withHoverEvent(HoverEvent.ShowText(Text.literal("§eClick to copy error message")))
6465
)
6566
val fullMessage = Text.empty()
6667
.append(CHAT_PREFIX_STRING)
@@ -73,14 +74,16 @@ object ChatUtils {
7374
private var style: Style = Style.EMPTY
7475

7576
fun copyContent(copyText: String): MessageBuilder {
76-
style = style.withClickEvent(ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, copyText))
77-
.withHoverEvent(HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal("§eClick to copy")))
77+
style = style.withClickEvent(ClickEvent.CopyToClipboard(copyText))
78+
// Corrected HoverEvent instantiation
79+
.withHoverEvent(HoverEvent.ShowText(Text.literal("§eClick to copy")))
7880
return this
7981
}
8082

8183
fun clickToRun(command: String): MessageBuilder {
82-
style = style.withClickEvent(ClickEvent(ClickEvent.Action.RUN_COMMAND, command))
83-
.withHoverEvent(HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal("§eClick to run:§a\n$command")))
84+
style = style.withClickEvent(ClickEvent.RunCommand(command))
85+
// Corrected HoverEvent instantiation
86+
.withHoverEvent(HoverEvent.ShowText(Text.literal("§eClick to run:§a\n$command")))
8487
return this
8588
}
8689

src/main/kotlin/io/github/frostzie/skyfall/utils/item/ItemUtils.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ object ItemUtils {
2020
val customDataComponent = itemStack.get(DataComponentTypes.CUSTOM_DATA)
2121
return customDataComponent?.let { data ->
2222
val nbt = data.copyNbt()
23-
if (nbt.contains(SKYBLOCK_ID, NbtCompound.STRING_TYPE.toInt())) {
24-
nbt.getString(SKYBLOCK_ID)
25-
} else {
26-
null
27-
}
23+
val skyblockIdOptional = nbt.getString(SKYBLOCK_ID)
24+
skyblockIdOptional.orElse(null)
2825
}
2926
}
3027

src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"schemaVersion": 1,
33
"id": "skyfall",
4-
"version": "0.0.1",
4+
"version": "0.1.1",
55
"name": "SkyFall",
66
"description": "QOL Hypixel Skyblock mod for newest versions of Minecraft",
77
"authors": [

src/main/resources/skyfall.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"MixinHidePotionHud",
1111
"MouseSensitivityMixin",
1212
"PropertySignatureIgnorePatchForSession",
13+
"SlotRenderingMixin",
1314
"TabListAccessor",
1415
"TextureUnpackBase64PadPatch",
1516
"YggdrasilSignatureIgnorePatch",

0 commit comments

Comments
 (0)