Skip to content

Commit

Permalink
remove reflection for AT's (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyfts authored Oct 21, 2024
1 parent 7449547 commit 12c8229
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 63 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ apiPackage = api
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile =
accessTransformersFile = neicustomdiagram_at.cfg

# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.github.dcysteine.neicustomdiagram.api.draw.Dimension;
import com.github.dcysteine.neicustomdiagram.api.draw.Point;
import com.github.dcysteine.neicustomdiagram.main.Reflection;
import com.github.dcysteine.neicustomdiagram.main.config.ConfigOptions;

import codechicken.lib.gui.GuiDraw;
Expand Down Expand Up @@ -113,8 +112,8 @@ public Point getRelativeMousePosition(int recipe) {
java.awt.Point mouse = GuiDraw.getMousePosition();
java.awt.Point offset = gui.getRecipePosition(recipe);

int x = mouse.x + horizontalScrollbar.getScroll() - (Reflection.GUI_LEFT.get(gui) + offset.x);
int y = mouse.y + verticalScrollbar.getScroll() - (Reflection.GUI_TOP.get(gui) + offset.y);
int x = mouse.x + horizontalScrollbar.getScroll() - gui.guiLeft + offset.x;
int y = mouse.y + verticalScrollbar.getScroll() - gui.guiTop + offset.y;
return Point.create(x, y);
}

Expand All @@ -132,7 +131,7 @@ Point getViewportPosition() {
}
GuiRecipe<?> gui = guiOptional.get();

return Point.create(Reflection.GUI_LEFT.get(gui) + SIDE_MARGIN, Reflection.GUI_TOP.get(gui) + TOP_MARGIN);
return Point.create(gui.guiLeft + SIDE_MARGIN, gui.guiTop + TOP_MARGIN);
}

Dimension getViewportDimension() {
Expand All @@ -143,9 +142,7 @@ Dimension getViewportDimension() {
}
GuiRecipe<?> gui = guiOptional.get();

return Dimension.create(
Reflection.X_SIZE.get(gui) - 2 * SIDE_MARGIN,
Reflection.Y_SIZE.get(gui) - (TOP_MARGIN + BOTTOM_MARGIN));
return Dimension.create(gui.xSize - 2 * SIDE_MARGIN, gui.ySize - (TOP_MARGIN + BOTTOM_MARGIN));
}

private void setScissor() {
Expand All @@ -162,9 +159,7 @@ private void setScissor() {
final int guiLeft = (int) matBuf.get(12);
final int guiTop = (int) matBuf.get(13);
final int left = guiLeft + SIDE_MARGIN + SCISSOR_MODELVIEW_OFFSET_X;
final int bottom = gui.height - (guiTop + Reflection.Y_SIZE.get(gui))
+ BOTTOM_MARGIN
+ SCISSOR_MODELVIEW_OFFSET_Y;
final int bottom = gui.height - (guiTop + gui.ySize) + BOTTOM_MARGIN + SCISSOR_MODELVIEW_OFFSET_Y;

final Minecraft minecraft = Minecraft.getMinecraft();
ScaledResolution res = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
Expand Down

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/resources/META-INF/neicustomdiagram_at.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public net.minecraft.client.gui.inventory.GuiContainer field_147003_i #guiLeft
public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guitop
public net.minecraft.client.gui.inventory.GuiContainer field_146999_f #xSize
public net.minecraft.client.gui.inventory.GuiContainer field_147000_g #ySize

0 comments on commit 12c8229

Please sign in to comment.