diff options
Diffstat (limited to 'src/main')
12 files changed, 27 insertions, 53 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() } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorGuiPlayerTabOverlay.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorGuiPlayerTabOverlay.java index d83fe603b..72bb00b0f 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorGuiPlayerTabOverlay.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorGuiPlayerTabOverlay.java @@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.gen.Accessor; public interface AccessorGuiPlayerTabOverlay { @Accessor("footer") IChatComponent getFooter_skyhanni(); + @Accessor("header") IChatComponent getHeader_skyhanni(); } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorKeyBinding.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorKeyBinding.java index 53abc49dc..e487ee73d 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorKeyBinding.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/AccessorKeyBinding.java @@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.mixins.transformers; import net.minecraft.client.settings.KeyBinding; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -import org.spongepowered.asm.mixin.gen.Invoker; @Mixin(KeyBinding.class) public interface AccessorKeyBinding { @@ -13,7 +12,4 @@ public interface AccessorKeyBinding { @Accessor("pressTime") void setPressTime_skyhanni(int pressTime); - - @Invoker("unpressKey") - void skyhanni_unpressKey(); } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiChat.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiChat.java index 87f01f792..c20ecc806 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiChat.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinGuiChat.java @@ -29,11 +29,6 @@ public class MixinGuiChat { @Shadow private List<String> foundPlayerNames = Lists.newArrayList(); - @Shadow - public void autocompletePlayerNames() { - - } - @Inject(method = "onAutocompleteResponse", at = @At(value = "HEAD"), cancellable = true) private void renderItemOverlayPost(String[] originalArray, CallbackInfo ci) { @@ -45,7 +40,7 @@ public class MixinGuiChat { this.playerNamesFound = false; this.foundPlayerNames.clear(); for (String s : result) { - if (s.length() > 0) { + if (!s.isEmpty()) { this.foundPlayerNames.add(s); } } @@ -53,12 +48,11 @@ public class MixinGuiChat { String s1 = this.inputField.getText().substring(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false)); String s2 = StringUtils.getCommonPrefix(result); s2 = EnumChatFormatting.getTextWithoutFormattingCodes(s2); - if (s2.length() > 0 && !s1.equalsIgnoreCase(s2)) { + if (!s2.isEmpty() && !s1.equalsIgnoreCase(s2)) { this.inputField.deleteFromCursor(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false) - this.inputField.getCursorPosition()); this.inputField.writeText(s2); - } else if (this.foundPlayerNames.size() > 0) { + } else if (!this.foundPlayerNames.isEmpty()) { this.playerNamesFound = true; - this.autocompletePlayerNames(); } } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinItemStack.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinItemStack.java index 9f78bc8dc..b96075d62 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinItemStack.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinItemStack.java @@ -4,10 +4,12 @@ import at.hannibal2.skyhanni.mixins.hooks.ItemStackCachedData; import at.hannibal2.skyhanni.utils.CachedItemData; import net.minecraft.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; @Mixin(ItemStack.class) public class MixinItemStack implements ItemStackCachedData { + @Unique public CachedItemData skyhanni_cachedData = new CachedItemData(); public CachedItemData getSkyhanni_cachedData() { diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetHandlerPlayClient.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetHandlerPlayClient.java index 8d2f6c5d3..879e41061 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetHandlerPlayClient.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetHandlerPlayClient.java @@ -2,14 +2,12 @@ package at.hannibal2.skyhanni.mixins.transformers; import at.hannibal2.skyhanni.events.EntityEquipmentChangeEvent; import at.hannibal2.skyhanni.mixins.hooks.NetHandlerPlayClientHookKt; -import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.entity.Entity; import net.minecraft.network.Packet; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraft.network.play.server.S04PacketEntityEquipment; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -18,9 +16,6 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(value = NetHandlerPlayClient.class, priority = 1001) public abstract class MixinNetHandlerPlayClient implements INetHandlerPlayClient { - @Shadow - private WorldClient clientWorldController; - @Inject(method = "addToSendQueue", at = @At("HEAD"), cancellable = true) private void onSendPacket(Packet<?> packet, CallbackInfo ci) { NetHandlerPlayClientHookKt.onSendPacket(packet, ci); diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetworkManager.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetworkManager.java index 7c0e47113..11d7ed309 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetworkManager.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinNetworkManager.java @@ -13,10 +13,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(value = NetworkManager.class, priority = 1001) public abstract class MixinNetworkManager extends SimpleChannelInboundHandler<Packet<?>> { - @Inject(method = "channelRead0", at = @At("HEAD"), cancellable = true) + @Inject(method = "channelRead0*", at = @At("HEAD"), cancellable = true) private void onReceivePacket(ChannelHandlerContext context, Packet<?> packet, CallbackInfo ci) { if (packet != null) { - NetworkManagerHookKt.onReceivePacket(context, packet, ci); + NetworkManagerHookKt.onReceivePacket(packet, ci); } } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderItem.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderItem.java index d4e4156d1..b40109b06 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderItem.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderItem.java @@ -14,18 +14,11 @@ public abstract class MixinRenderItem { @Inject(method = "renderItemOverlayIntoGUI", at = @At("RETURN")) private void renderItemOverlayPost(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, String text, CallbackInfo ci) { - RenderItemHookKt.renderItemOverlayPost(fr, stack, xPosition, yPosition, text, ci); - } - - @Inject(method = "renderEffect", at = @At("HEAD"), cancellable = true) - public void onRenderEffect(CallbackInfo ci) { - if (RenderItemHookKt.getSkipGlint()) { - ci.cancel(); - } + RenderItemHookKt.renderItemOverlayPost(fr, stack, xPosition, yPosition, text); } @Inject(method = "renderItemIntoGUI", at = @At("RETURN")) public void renderItemReturn(ItemStack stack, int x, int y, CallbackInfo ci) { - RenderItemHookKt.renderItemReturn(stack, x, y, ci); + RenderItemHookKt.renderItemReturn(stack, x, y); } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiContainer.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiContainer.java index 2096841bf..02270a522 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiContainer.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiContainer.java @@ -16,39 +16,39 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public abstract class MixinGuiContainer extends GuiScreen { @Unique - private final GuiContainerHook hook = new GuiContainerHook(this); + private final GuiContainerHook skyHanni$hook = new GuiContainerHook(this); @Shadow private Slot theSlot; @Inject(method = "keyTyped", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityPlayerSP;closeScreen()V", shift = At.Shift.BEFORE), cancellable = true) private void closeWindowPressed(CallbackInfo ci) { - hook.closeWindowPressed(ci); + skyHanni$hook.closeWindowPressed(ci); } @Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;color(FFFF)V", ordinal = 1)) private void backgroundDrawn(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - hook.backgroundDrawn(mouseX, mouseY, partialTicks, ci); + skyHanni$hook.backgroundDrawn(mouseX, mouseY, partialTicks); } @Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawGuiContainerForegroundLayer(II)V", shift = At.Shift.AFTER)) private void onForegroundDraw(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - hook.foregroundDrawn(mouseX, mouseY, partialTicks, ci); + skyHanni$hook.foregroundDrawn(mouseX, mouseY, partialTicks); } @Inject(method = "drawSlot", at = @At("HEAD"), cancellable = true) private void onDrawSlot(Slot slot, CallbackInfo ci) { - hook.onDrawSlot(slot, ci); + skyHanni$hook.onDrawSlot(slot, ci); } - @Inject(method = "drawSlot", at = @At("RETURN"), cancellable = true) + @Inject(method = "drawSlot", at = @At("RETURN")) private void onDrawSlotPost(Slot slot, CallbackInfo ci) { - hook.onDrawSlotPost(slot, ci); + skyHanni$hook.onDrawSlotPost(slot); } @Inject(method = "handleMouseClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;windowClick(IIIILnet/minecraft/entity/player/EntityPlayer;)Lnet/minecraft/item/ItemStack;"), cancellable = true) private void onMouseClick(Slot slot, int slotId, int clickedButton, int clickType, CallbackInfo ci) { - hook.onMouseClick(slot, slotId, clickedButton, clickType, ci); + skyHanni$hook.onMouseClick(slot, slotId, clickedButton, clickType, ci); } @Inject(method = "drawScreen", @@ -59,7 +59,7 @@ public abstract class MixinGuiContainer extends GuiScreen { ) ) public void drawScreen_after(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - hook.onDrawScreenAfter(mouseX, mouseY, ci); + skyHanni$hook.onDrawScreenAfter(mouseX, mouseY, ci); ToolTipData.Companion.setLastSlot(theSlot); } } |