diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-08 00:07:49 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-08 00:07:49 +0200 |
commit | ca686a46e4044108773d4e0422bedad9558f8afb (patch) | |
tree | aa6a27d4c435638a0ca499c9f2e01e527924f85b /src/main/java/at/hannibal2/skyhanni/mixins/hooks | |
parent | 02ac961b3f1a371302963559e875698de8eb7a1d (diff) | |
download | skyhanni-ca686a46e4044108773d4e0422bedad9558f8afb.tar.gz skyhanni-ca686a46e4044108773d4e0422bedad9558f8afb.tar.bz2 skyhanni-ca686a46e4044108773d4e0422bedad9558f8afb.zip |
code cleanup in mixins
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins/hooks')
4 files changed, 8 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt index cfdff8a73..5b41f87c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt @@ -20,19 +20,20 @@ class GuiContainerHook(guiAny: Any) { if (CloseWindowEvent(gui, gui.inventorySlots).postAndCatch()) ci.cancel() } - fun backgroundDrawn(mouseX: Int, mouseY: Int, partialTicks: Float, ci: CallbackInfo) { + fun backgroundDrawn(mouseX: Int, mouseY: Int, partialTicks: Float) { GuiContainerEvent.BackgroundDrawnEvent(gui, gui.inventorySlots, mouseX, mouseY, partialTicks).postAndCatch() } - fun foregroundDrawn(mouseX: Int, mouseY: Int, partialTicks: Float, ci: CallbackInfo) { + fun foregroundDrawn(mouseX: Int, mouseY: Int, partialTicks: Float) { GuiContainerEvent.ForegroundDrawnEvent(gui, gui.inventorySlots, mouseX, mouseY, partialTicks).postAndCatch() } fun onDrawSlot(slot: Slot, ci: CallbackInfo) { - if (GuiContainerEvent.DrawSlotEvent.GuiContainerDrawSlotPre(gui, gui.inventorySlots, slot).postAndCatch()) ci.cancel() + val event = GuiContainerEvent.DrawSlotEvent.GuiContainerDrawSlotPre(gui, gui.inventorySlots, slot) + if (event.postAndCatch()) ci.cancel() } - fun onDrawSlotPost(slot: Slot, ci: CallbackInfo) { + fun onDrawSlotPost(slot: Slot) { GuiContainerEvent.DrawSlotEvent.GuiContainerDrawSlotPost(gui, gui.inventorySlots, slot).postAndCatch() } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiPlayerTabOverlayHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiPlayerTabOverlayHook.kt index 5d0542e9a..158995e55 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiPlayerTabOverlayHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiPlayerTabOverlayHook.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.events.TabListLineRenderEvent import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable import kotlin.reflect.KProperty -var tabListGuard by object : ThreadLocal<Boolean>() { +var tabListGuard by object : ThreadLocal<Boolean>() { override fun initialValue(): Boolean { return false } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/NetworkManagerHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/NetworkManagerHook.kt index b5b4ec0ea..1466ed44d 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/NetworkManagerHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/NetworkManagerHook.kt @@ -1,11 +1,10 @@ package at.hannibal2.skyhanni.mixins.hooks import at.hannibal2.skyhanni.events.PacketEvent -import io.netty.channel.ChannelHandlerContext import net.minecraft.network.Packet import org.spongepowered.asm.mixin.injection.callback.CallbackInfo -fun onReceivePacket(context: ChannelHandlerContext, packet: Packet<*>, ci: CallbackInfo) { +fun onReceivePacket(packet: Packet<*>, ci: CallbackInfo) { if (packet != null) { if (PacketEvent.ReceiveEvent(packet).postAndCatch()) ci.cancel() } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt index b94fad0d2..ae9b02354 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderItemHook.kt @@ -4,12 +4,6 @@ import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.events.RenderRealOverlayEvent import net.minecraft.client.gui.FontRenderer import net.minecraft.item.ItemStack -import net.minecraft.util.ResourceLocation -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo - -val RES_ITEM_GLINT = ResourceLocation("textures/misc/enchanted_item_glint.png") - -var skipGlint = false fun renderItemOverlayPost( fr: FontRenderer, @@ -17,7 +11,6 @@ fun renderItemOverlayPost( xPosition: Int, yPosition: Int, text: String?, - ci: CallbackInfo ) { GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost( fr, @@ -28,6 +21,6 @@ fun renderItemOverlayPost( ).postAndCatch() } -fun renderItemReturn(stack: ItemStack, x: Int, y: Int, ci: CallbackInfo) { +fun renderItemReturn(stack: ItemStack, x: Int, y: Int) { RenderRealOverlayEvent(stack, x, y).postAndCatch() } |