Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework GuiScreenMixin #31

Merged
merged 4 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Add your dependencies here

dependencies {
compileOnly("com.github.GTNewHorizons:CodeChickenCore:1.3.7:dev")
compileOnly("com.github.GTNewHorizons:Natura:2.7.1:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:CodeChickenCore:1.3.9:dev")
compileOnly("com.github.GTNewHorizons:Natura:2.7.4:dev") { transitive = false }
compileOnly(deobfCurse("pams-harvestcraft-221857:2270206"))

runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.6.34-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.6.42-GTNH:dev")
}
11 changes: 2 additions & 9 deletions src/main/java/squeek/applecore/client/TooltipOverlayHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.lwjgl.opengl.GL11;

import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
Expand All @@ -35,14 +34,8 @@
public class TooltipOverlayHandler {

private static final ResourceLocation modIcons = new ResourceLocation(ModInfo.MODID_LOWER, "textures/icons.png");
// private static final Field guiLeft = ReflectionHelper.findField(GuiContainer.class,
// ObfuscationReflectionHelper.remapFieldNames(GuiContainer.class.getName(), "guiLeft", "field_147003_i", "i"));
// private static final Field guiTop = ReflectionHelper.findField(GuiContainer.class,
// ObfuscationReflectionHelper.remapFieldNames(GuiContainer.class.getName(), "guiTop", "field_147009_r", "r"));
public static final Field theSlot = ReflectionHelper.findField(
GuiContainer.class,
ObfuscationReflectionHelper
.remapFieldNames(GuiContainer.class.getName(), "theSlot", "field_147006_u", "u"));
public static final Field theSlot = ReflectionHelper
.findField(GuiContainer.class, "theSlot", "field_147006_u", "u");
private static Method getStackMouseOver = null;
private static Method isNEIHidden = null;
private static Field itemPanel = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
package squeek.applecore.mixins.early.minecraft;

import java.util.Iterator;
import java.util.List;

import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;

import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import com.llamalad7.mixinextras.sugar.Local;

import squeek.applecore.client.TooltipOverlayHandler;

@Mixin(GuiScreen.class)
public class GuiScreenMixin {

@Inject(
at = @At(
opcode = Opcodes.PUTFIELD,
ordinal = 0,
remap = true,
target = "Lnet/minecraft/client/gui/GuiScreen;zLevel:F",
value = "FIELD"),
method = "drawHoveringText",
at = @At(value = "INVOKE", target = "Ljava/util/List;size()I", shift = At.Shift.BEFORE),
slice = @Slice(
from = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiScreen;drawGradientRect(IIIIII)V",
ordinal = 0)),
locals = LocalCapture.CAPTURE_FAILHARD)
private void onDrawHoveringText(List<String> textLines, int x, int y, FontRenderer font, CallbackInfo ci, int k,
Iterator<String> iterator, int j2, int k2, int i1, int j1, int k1, int l1, int i2) {
TooltipOverlayHandler.toolTipX = j2;
TooltipOverlayHandler.toolTipY = k2;
TooltipOverlayHandler.toolTipW = k;
TooltipOverlayHandler.toolTipH = i1;
remap = false)
private void onDrawHoveringText(CallbackInfo ci, @Local(ordinal = 3) int x, @Local(ordinal = 4) int y,
@Local(ordinal = 2) int w, @Local(ordinal = 5) int h) {
TooltipOverlayHandler.toolTipX = x;
TooltipOverlayHandler.toolTipY = y;
TooltipOverlayHandler.toolTipW = w;
TooltipOverlayHandler.toolTipH = h;
}
}