-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Replace PacketThreadUtilTransformer with a Mixin
- Loading branch information
1 parent
ecc8a15
commit 88e2a2e
Showing
4 changed files
with
38 additions
and
90 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/gg/skytils/skytilsmod/mixins/transformers/network/MixinPacketThreadUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Skytils - Hypixel Skyblock Quality of Life Mod | ||
* Copyright (C) 2020-2025 Skytils | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package gg.skytils.skytilsmod.mixins.transformers.network; | ||
|
||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; | ||
import gg.skytils.skytilsmod.events.impl.MainReceivePacketEvent; | ||
import net.minecraft.network.INetHandler; | ||
import net.minecraft.network.Packet; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(targets = "net.minecraft.network.PacketThreadUtil$1") | ||
public abstract class MixinPacketThreadUtil<T extends INetHandler> implements Runnable { | ||
@WrapWithCondition(method="run", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/Packet;processPacket(Lnet/minecraft/network/INetHandler;)V")) | ||
private boolean processMainThreadPacket(Packet<T> packet, T netHandler) { | ||
return !(new MainReceivePacketEvent<>( | ||
netHandler, | ||
packet | ||
).postAndCatch()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 0 additions & 89 deletions
89
src/main/kotlin/gg/skytils/skytilsmod/asm/transformers/PacketThreadUtilTransformer.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters