Skip to content

Commit 0be7afc

Browse files
chore: Use Hypixel Mod API Forge Impl 1.0.1.1
1 parent aa69d1b commit 0be7afc

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

build.gradle.kts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,13 @@ dependencies {
154154
exclude(module = "bcprov-jdk18on")
155155
}
156156
compileOnly("org.bouncycastle:bcprov-jdk18on:1.78.1")
157-
shadowMe("net.hypixel:mod-api:0.4.0")
158157

159158

159+
compileOnly("net.hypixel:mod-api-forge:1.0.1.1") {
160+
exclude(group = "me.djtheredstoner", module = "DevAuth-forge-legacy")
161+
}
162+
shadowMe("net.hypixel:mod-api-forge-tweaker:1.0.1.1")
163+
160164
shadowMe(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.5")!!)
161165
annotationProcessor("org.spongepowered:mixin:0.8.5:processor")
162166
compileOnly("org.spongepowered:mixin:0.8.5")
@@ -222,7 +226,7 @@ tasks {
222226
relocate("kotlinx.serialization", "gg.skytils.ktx-serialization")
223227
relocate("kotlinx.coroutines", "gg.skytils.ktx-coroutines")
224228
relocate("gg.essential.vigilance", "gg.skytils.vigilance")
225-
relocate("net.hypixel", "gg.skytils.hypixel-net")
229+
relocate("net.hypixel.modapi.tweaker", "gg.skytils.hypixel-net.modapi.tweaker")
226230

227231
exclude(
228232
"**/LICENSE_MixinExtras",

src/main/java/gg/skytils/skytilsmod/tweaker/SkytilsTweaker.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
package gg.skytils.skytilsmod.tweaker;
2020

2121
import gg.essential.loader.stage0.EssentialSetupTweaker;
22+
import net.hypixel.modapi.tweaker.HypixelModAPITweaker;
23+
import net.minecraft.launchwrapper.Launch;
2224
import net.minecraft.launchwrapper.LaunchClassLoader;
2325
import net.minecraftforge.fml.relauncher.FMLSecurityManager;
2426

@@ -53,6 +55,10 @@ public void acceptOptions(List<String> args, File gameDir, File assetsDir, Strin
5355
@Override
5456
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
5557
super.injectIntoClassLoader(classLoader);
58+
59+
@SuppressWarnings("unchecked")
60+
List<String> tweakClassNames = (List<String>) Launch.blackboard.get("TweakClasses");
61+
tweakClassNames.add(HypixelModAPITweaker.class.getName());
5662
}
5763

5864
@Override

src/main/kotlin/gg/skytils/skytilsmod/listeners/ServerPayloadInterceptor.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import kotlin.time.Duration.Companion.minutes
4848

4949
object ServerPayloadInterceptor {
5050
private val receivedPackets = MutableSharedFlow<ClientboundHypixelPacket>()
51+
private var didSetPacketSender = false
5152

5253
@SubscribeEvent(priority = EventPriority.HIGHEST)
5354
fun onReceivePacket(event: PacketEvent.ReceiveEvent) {
@@ -104,6 +105,7 @@ object ServerPayloadInterceptor {
104105
println("Failed to send packet ${it.identifier}")
105106
} != null
106107
}
108+
didSetPacketSender = true
107109
}
108110
Skytils.launch {
109111
while (getNetClientHandler() == null) {
@@ -112,7 +114,7 @@ object ServerPayloadInterceptor {
112114
}
113115
withContext(Dispatchers.MC) {
114116
modAPI.subscribeToEventPacket(ClientboundLocationPacket::class.java)
115-
modAPI.invokeSendRegisterPacket(true)
117+
if (didSetPacketSender) modAPI.invokeSendRegisterPacket(true)
116118
}
117119
}
118120
}

0 commit comments

Comments
 (0)