Compare commits

..
4 Commits
Author SHA1 Message Date
xiaozhou233 30fde895b6 Docs: README.md 2026-11-10 15:00:21 +08:00
xiaozhou233 ed7fa13e7f Fix: Interpolate world positions with the frame's partial tick
- Pass the 1.8.9 HUD method's partial tick through the render hook into
  EventRender2D instead of reading Timer.renderPartialTicks reflectively
- Let WorldView.snapshot() take that value so ESP projection matches the
  rendered world and no longer advances in 20 Hz steps
- Keep the reflected timer read as a fallback and warn once when it cannot
  be resolved instead of silently interpolating with 0
2026-11-10 13:47:55 +08:00
xiaozhou233 d8a46a1b70 Feat: Show module settings as a page in the ClickGUI content area
- Replace the floating SettingsWindow with an inline settings page
- Return to the module list via the back button or a category click
- Scroll the module list and the settings page with the mouse wheel
- Share module row geometry through ContentList and add a scrollbar
  helper
- Bail out of scroll input when the content fits
2026-11-10 13:26:19 +08:00
xiaozhou233 09de736269 Feat: Add mouse wheel scrolling to client input
- Queue wheel notches in ClientInput for the next frame
- Forward wheel deltas from the 1.8.9 screen and 26.2 input screen
- Hook GuiScreen#handleMouseInput after vanilla, guarded so a
  missing method never disables the other input injections
- Shrink HUD module font size to 10
2026-11-10 13:12:22 +08:00
25 changed files with 773 additions and 350 deletions

No files matched your search

@@ -17,10 +17,19 @@ public final class Render2DEvents {
* screen too, so the hook must pass this through.
*/
public static void fire(Object platformContext, boolean inWorld) {
fire(platformContext, inWorld, Float.NaN);
}
/**
* @param partialTicks the partial tick the game rendered this frame with.
* {@link Float#NaN} when the hook cannot supply it.
*/
public static void fire(Object platformContext, boolean inWorld,
float partialTicks) {
try {
Render2DManager manager = OrangeX.getInstance().getRender2DManager();
if (manager != null) {
manager.fire(platformContext, inWorld);
manager.fire(platformContext, inWorld, partialTicks);
}
} catch (Throwable throwable) {
if (!failureLogged) {
@@ -15,10 +15,16 @@ public class EventRender2D {
private final Render2D render2D;
private final boolean inWorld;
private final float partialTicks;
public EventRender2D(Render2D render2D, boolean inWorld) {
this(render2D, inWorld, Float.NaN);
}
public EventRender2D(Render2D render2D, boolean inWorld, float partialTicks) {
this.render2D = render2D;
this.inWorld = inWorld;
this.partialTicks = partialTicks;
}
public Render2D getRender2D() {
@@ -31,4 +37,16 @@ public class EventRender2D {
public boolean isInWorld() {
return inWorld;
}
/**
* The partial tick the game used for this frame's world render, i.e. the
* interpolation factor between the previous and the current tick.
*
* <p>Feature code must use this value instead of reading a timer of its own
* so projected world positions line up with the rendered world. It is
* {@link Float#NaN} when the hook could not supply one.</p>
*/
public float getPartialTicks() {
return partialTicks;
}
}
@@ -67,6 +67,16 @@ public final class GuiInputHook extends ClassHook {
// The empty screen is an overlay: it must not pause singleplayer.
injectAfter(ctClass, "doesGuiPauseGame", "()Z",
"if (orangexbridge.Hooks.isOurScreen($0)) { $_ = false; }");
// Wheel scrolling for the ClickGUI. Injecting after vanilla keeps its
// mouse-button dispatch intact; the wheel event is still readable.
try {
injectAfter(ctClass, "handleMouseInput", "()V",
"orangexbridge.Legacy.forwardScroll($0);");
} catch (Throwable ignored) {
// Scrolling is optional: never let it disable the input hooks
// above on a runtime where this method cannot be resolved.
}
}
private void injectBefore(CtClass ctClass, String name,
@@ -101,7 +101,8 @@ public final class Render2DHook extends ClassHook {
throw new IllegalStateException(
"No (F)V HUD method found in " + ctClass.getName());
}
method.insertAfter("orangexbridge.Hooks.render2d(null, true);");
method.insertAfter(
"orangexbridge.Hooks.render2d(null, true, $1);");
return;
} else {
MappingMethod target = resolver.mapMethod(
@@ -112,7 +113,10 @@ public final class Render2DHook extends ClassHook {
methodDescriptor = target.getTargetDescriptor();
}
CtMethod method = ctClass.getMethod(methodName, methodDescriptor);
method.insertAfter("orangexbridge.Hooks.render2d(null, true);");
// $1 is the frame's partial tick: pass it through so features
// interpolate world positions exactly like the world render.
method.insertAfter(
"orangexbridge.Hooks.render2d(null, true, $1);");
break;
}
case V26_2: {
@@ -21,6 +21,7 @@ public final class ClientInput {
private static volatile boolean leftDown;
private static volatile boolean rightDown;
private static volatile boolean middleDown;
private static double scrollAmount;
private static boolean started;
private static boolean pendingOpen;
@@ -111,6 +112,29 @@ public final class ClientInput {
}
}
/**
* Queues a wheel notch for the next frame. Positive is one notch up.
*/
public static synchronized void onMouseScroll(double amount) {
if (amount != 0.0) {
scrollAmount += amount;
}
}
public static void onMouseScroll(double x, double y, double amount) {
onMouseMove(x, y);
onMouseScroll(amount);
}
/**
* @return the wheel amount accumulated since the previous call.
*/
public static synchronized double consumeScroll() {
double amount = scrollAmount;
scrollAmount = 0.0;
return amount;
}
public static void reset() {
if (open) {
System.out.println("[OrangeX] Input screen closed");
@@ -119,6 +143,7 @@ public final class ClientInput {
leftDown = false;
rightDown = false;
middleDown = false;
scrollAmount = 0.0;
}
public static boolean isOpen() {
@@ -1,5 +1,6 @@
package cn.xiaozhou233.orangex.input.internal.v1_8_9;
import cn.xiaozhou233.orangex.event.facade.InputEvents;
import cn.xiaozhou233.orangex.hook.ClassPoolUtils;
import cn.xiaozhou233.orangex.hook.HookManager;
import cn.xiaozhou233.orangex.hook.JuiceAgentBridge;
@@ -272,13 +273,29 @@ public final class V1_8_9Input implements VersionInput {
}
/**
* Used by injected {@code GuiScreen}/{@code KeyBinding} code to ignore
* LWJGL auto-repeat events.
* Used by injected {@code GuiScreen} code to ignore LWJGL auto-repeat
* events.
*/
public static boolean isRepeatEvent() {
return Keyboard.isRepeatEvent();
}
/**
* Called after {@code GuiScreen#handleMouseInput} ran. The wheel event is
* still readable at this point and must not consume the vanilla mouse
* button dispatch.
*/
public static void forwardScroll(Object screen) {
if (!InputEvents.isOurInputScreen(screen)) {
return;
}
int wheel = Mouse.getEventDWheel();
if (wheel != 0) {
ClientInput.onMouseScroll(wheel > 0 ? 1.0 : -1.0);
}
}
@Override
public double getGuiMouseX() {
Object screen = shellScreen;
@@ -63,7 +63,7 @@ public final class V26_2InputScreen extends Screen {
@Override
public boolean mouseScrolled(double x, double y,
double scrollX, double scrollY) {
ClientInput.onMouseMove(x, y);
ClientInput.onMouseScroll(x, y, scrollY);
return true;
}
}
@@ -79,7 +79,7 @@ public class ESP extends Module {
WorldSnapshot snapshot;
try {
snapshot = world.snapshot();
snapshot = world.snapshot(event.getPartialTicks());
} catch (Throwable throwable) {
// A broken wrapper must not kill the whole HUD frame.
System.err.println("[ESP] Failed to read world snapshot: "
@@ -18,7 +18,7 @@ public class HUD extends Module {
private static final float RAINBOW_CYCLE = 6000f;
private static final int LOGO_FONT_SIZE = 22;
private static final int MODULE_FONT_SIZE = 14;
private static final int MODULE_FONT_SIZE = 10;
private static final int LOGO_START_X = 5;
private static final int LOGO_START_Y = 5;
@@ -36,7 +36,7 @@ public final class Render2DManager {
}
public void fire(Object platformContext) {
fire(platformContext, true);
fire(platformContext, true, Float.NaN);
}
/**
@@ -45,6 +45,15 @@ public final class Render2DManager {
* event is dropped unless {@link #isRenderInMenus()} is on.
*/
public void fire(Object platformContext, boolean inWorld) {
fire(platformContext, inWorld, Float.NaN);
}
/**
* @param partialTicks the partial tick the game rendered this frame with,
* or {@link Float#NaN} when the caller has none.
*/
public void fire(Object platformContext, boolean inWorld,
float partialTicks) {
if (!inWorld && !renderInMenus) {
return;
}
@@ -60,7 +69,7 @@ public final class Render2DManager {
Render2D context = backend.createRender2D(fonts, platformContext);
try {
eventBus.post(new EventRender2D(context, inWorld));
eventBus.post(new EventRender2D(context, inWorld, partialTicks));
} finally {
context.flush();
}
@@ -28,6 +28,19 @@ public final class ClickGuiModules {
return settings;
}
/**
* Allocation-free variant of {@link #settingsOf(Module)} for rows that only
* need to know whether a settings page can be opened.
*/
public static boolean hasSettings(Module module) {
for (Value<?> value : module.getVisibleValues()) {
if (!(value instanceof KeybindValue)) {
return true;
}
}
return false;
}
public static String displayName(ModuleCategory category) {
String name = category.name();
return name.substring(0, 1) + name.substring(1).toLowerCase(Locale.ROOT);
@@ -50,6 +50,7 @@ public final class ClickGuiStyle {
public static final int COLOR_SIDEBAR_BORDER = 0xFF24242C;
public static final int COLOR_SWITCH_OFF = 0xFF34343F;
public static final int COLOR_KNOB_OFF = 0xFF9A9AA8;
public static final int COLOR_SCROLLBAR = 0x40FFFFFF;
private ClickGuiStyle() {
}
@@ -81,6 +82,28 @@ public final class ClickGuiStyle {
return top + (height - font.getStringHeight()) / 2.0;
}
/**
* Draws a thin scrollbar for a scrollable list. Nothing is drawn while the
* content fits, so short lists look unchanged.
*/
public static void drawScrollbar(Render2D graphics, double x, double top,
double viewHeight, double contentHeight,
double scroll) {
if (contentHeight <= viewHeight + 0.5) {
return;
}
double thumbHeight = Math.max(18.0,
viewHeight * (viewHeight / contentHeight));
double maxScroll = contentHeight - viewHeight;
double progress = maxScroll <= 0.0 ? 0.0
: clamp((float) (scroll / maxScroll), 0.0f, 1.0f);
double thumbY = top + (viewHeight - thumbHeight) * progress;
graphics.fillRoundedRect(x, thumbY, 2.0, thumbHeight, 1.0,
COLOR_SCROLLBAR);
}
public static boolean isInside(double mouseX, double mouseY,
double x, double y,
double width, double height) {
@@ -0,0 +1,78 @@
package cn.xiaozhou233.orangex.ui.clickgui;
import cn.xiaozhou233.orangex.modules.Module;
import java.util.List;
/**
* Row geometry for the module list.
*
* <p>Module rows are evenly sized, so a row's position is just its index times
* the row stride minus the scroll offset. The renderer and the input code share
* this class so both always agree on where a row is.</p>
*/
public final class ContentList {
private final ClickGuiLayout layout;
private final List<Module> modules;
private float scroll;
public ContentList(ClickGuiLayout layout, List<Module> modules,
float scroll) {
this.layout = layout;
this.modules = modules;
this.scroll = scroll;
}
public List<Module> modules() {
return modules;
}
public float scroll() {
return scroll;
}
public void scrollBy(float amount) {
scroll += amount;
}
/**
* Clamps the scroll offset to the current content, so switching category
* never leaves the list overscrolled.
*/
public void clampScroll() {
scroll = ClickGuiStyle.clamp(scroll, 0.0f, maxScroll());
}
public float rowStride() {
return ClickGuiStyle.MODULE_HEIGHT + ClickGuiStyle.MODULE_GAP;
}
public float rowTop(int index) {
return layout.listTop() + index * rowStride() - scroll;
}
public float contentHeight() {
return modules.isEmpty() ? 0.0f
: modules.size() * rowStride() - ClickGuiStyle.MODULE_GAP;
}
public float maxScroll() {
return Math.max(0.0f,
contentHeight() - (layout.listBottom() - layout.listTop()));
}
/**
* @return the index of the module row under {@code mouseY}, or {@code -1}.
*/
public int moduleIndexAt(float mouseY) {
for (int i = 0; i < modules.size(); i++) {
float top = rowTop(i);
if (mouseY >= top && mouseY <= top + ClickGuiStyle.MODULE_HEIGHT) {
return i;
}
}
return -1;
}
}
@@ -11,8 +11,9 @@ import java.util.List;
/**
* Draws the module list for the selected category.
*
* <p>Module settings are not drawn inline; right-clicking a module opens the
* separate {@link SettingsWindow}.</p>
* <p>Right-clicking a module opens its settings page in this same content area
* (see {@link SettingsSection}). The list scrolls with the wheel and shows a
* scrollbar when it does not fit.</p>
*/
public final class ContentRenderer {
@@ -20,13 +21,13 @@ public final class ContentRenderer {
}
public static void draw(Render2D graphics, ClickGuiLayout layout,
List<Module> modules, ModuleCategory category,
ContentList rows, ModuleCategory category,
ClickGuiAnimator animator, float delta,
double mouseX, double mouseY) {
float x = layout.x();
float y = layout.y();
float contentX = layout.contentX();
float contentWidth = layout.contentWidth();
List<Module> modules = rows.modules();
FontRenderer title = ClickGuiStyle.font(graphics, 13.0f, true);
title.drawString(ClickGuiModules.displayName(category), contentX,
@@ -57,22 +58,30 @@ public final class ContentRenderer {
contentX + (contentWidth - empty.getStringWidth(text)) / 2.0,
listTop + 14, ClickGuiStyle.COLOR_TEXT_MUTED);
} else {
float rowY = listTop;
for (int i = 0; i < modules.size(); i++) {
Module module = modules.get(i);
float rowY = rows.rowTop(i);
for (Module module : modules) {
boolean hovered = ClickGuiStyle.isInside(mouseX, mouseY,
contentX, rowY, contentWidth,
ClickGuiStyle.MODULE_HEIGHT);
if (rowY > listBottom
|| rowY + ClickGuiStyle.MODULE_HEIGHT < listTop) {
continue;
}
boolean hovered = mouseY >= listTop && mouseY <= listBottom
&& ClickGuiStyle.isInside(mouseX, mouseY, contentX,
rowY, contentWidth, ClickGuiStyle.MODULE_HEIGHT);
float hover = animator.hover(module, hovered, delta);
drawModuleRow(graphics, layout, module, rowY, hover,
animator, delta);
rowY += ClickGuiStyle.MODULE_HEIGHT + ClickGuiStyle.MODULE_GAP;
drawModuleRow(graphics, layout, module, rowY, hover, animator,
delta);
}
}
graphics.disableScissor();
ClickGuiStyle.drawScrollbar(graphics, contentX + contentWidth - 3,
listTop, listBottom - listTop, rows.contentHeight(),
rows.scroll());
}
private static void drawModuleRow(Render2D graphics, ClickGuiLayout layout,
@@ -8,10 +8,9 @@ import cn.xiaozhou233.orangex.modules.ModuleCategory;
import cn.xiaozhou233.orangex.modules.ModuleManager;
import cn.xiaozhou233.orangex.render.api.Render2D;
import cn.xiaozhou233.orangex.ui.clickgui.component.Component;
import cn.xiaozhou233.orangex.value.BooleanValue;
import cn.xiaozhou233.orangex.value.ModeValue;
import cn.xiaozhou233.orangex.value.Value;
import java.util.Collections;
import java.util.List;
/**
@@ -19,8 +18,9 @@ import java.util.List;
*
* <p>A single rounded window with a category sidebar on the left and the
* selected category's modules on the right. Left-clicking a module toggles it;
* right-clicking a module opens its settings in the separate
* {@link SettingsWindow}. The window itself can be dragged by its header.</p>
* right-clicking a module swaps the content area to its settings page, which is
* left with the back button next to the module name. The window itself can be
* dragged by its header.</p>
*
* <p>All coordinates are Minecraft GUI pixels. Input is polled from
* {@link ClientInput} because the empty input screen does not forward
@@ -31,14 +31,21 @@ public final class MainPanel extends Component {
private static final ModuleCategory[] CATEGORIES = ModuleCategory.values();
/** Pixels scrolled per wheel notch. */
private static final float SCROLL_STEP = 24.0f;
private final ModuleManager moduleManager =
OrangeX.getInstance().getModuleManager();
private final ClickGuiAnimator animator = new ClickGuiAnimator();
private final SettingsWindow settingsWindow = new SettingsWindow();
private ModuleCategory selectedCategory = ModuleCategory.RENDER;
/** Module whose settings page replaces the list, or {@code null}. */
private Module settingsModule;
private float scrollOffset;
private boolean hasPosition;
private boolean dragging;
private float dragOffsetX;
@@ -56,6 +63,8 @@ public final class MainPanel extends Component {
updateBounds(graphics);
ClickGuiLayout layout = layout();
applyScroll(layout);
float delta = updateDelta();
double mouseX = ClientInput.getMouseX();
double mouseY = ClientInput.getMouseY();
@@ -68,23 +77,18 @@ public final class MainPanel extends Component {
PanelChrome.drawHeader(graphics, layout);
SidebarRenderer.draw(graphics, layout, selectedCategory,
moduleManager.getAllModules(), animator, delta, mouseX, mouseY);
ContentRenderer.draw(graphics, layout,
modulesOf(selectedCategory), selectedCategory,
animator, delta, mouseX, mouseY);
settingsWindow.render(graphics, delta, mouseX, mouseY);
if (settingsModule == null) {
ContentRenderer.draw(graphics, layout, contentList(layout),
selectedCategory, animator, delta, mouseX, mouseY);
} else {
SettingsSection.draw(graphics, layout, settingsModule,
settingsOf(), scrollOffset, animator, delta, mouseX, mouseY);
}
}
@Override
public void mouseClicked(float mouseX, float mouseY, int button) {
if (settingsWindow.isOpen()) {
if (settingsWindow.mouseClicked(mouseX, mouseY, button)) {
return;
}
settingsWindow.close();
return;
}
if (!ClickGuiStyle.isInside(mouseX, mouseY, x, y, width, height)) {
return;
}
@@ -102,7 +106,15 @@ public final class MainPanel extends Component {
ClickGuiLayout layout = layout();
ModuleCategory category = categoryAt(layout, mouseX, mouseY);
if (category != null) {
selectedCategory = category;
if (category != selectedCategory) {
selectedCategory = category;
}
closeSettings();
return;
}
if (settingsModule != null) {
handleSettingsClick(layout, mouseX, mouseY, button);
return;
}
@@ -111,11 +123,6 @@ public final class MainPanel extends Component {
@Override
public void mouseDragged(float mouseX, float mouseY, int button) {
if (settingsWindow.isOpen()) {
settingsWindow.mouseDragged(mouseX, mouseY, button);
return;
}
if (!dragging || button != 0) {
return;
}
@@ -135,7 +142,6 @@ public final class MainPanel extends Component {
@Override
public void mouseReleased(float mouseX, float mouseY, int button) {
settingsWindow.mouseReleased(mouseX, mouseY, button);
if (button == 0) {
dragging = false;
}
@@ -143,7 +149,7 @@ public final class MainPanel extends Component {
public void resetInteraction() {
dragging = false;
settingsWindow.close();
closeSettings();
}
/* ------------------------------------------------------------------ */
@@ -155,30 +161,50 @@ public final class MainPanel extends Component {
if (mouseY < layout.listTop() || mouseY > layout.listBottom()) {
return false;
}
float contentX = layout.contentX();
float contentWidth = layout.contentWidth();
float moduleHeight = ClickGuiStyle.MODULE_HEIGHT;
float rowY = layout.listTop();
for (Module module : modulesOf(selectedCategory)) {
if (ClickGuiStyle.isInside(mouseX, mouseY, contentX, rowY,
contentWidth, moduleHeight)) {
if (button == 0) {
module.toggle();
} else if (button == 1
&& !ClickGuiModules.settingsOf(module).isEmpty()) {
settingsWindow.open(module, layout);
}
return true;
}
rowY += moduleHeight + ClickGuiStyle.MODULE_GAP;
if (mouseX < layout.contentX()
|| mouseX > layout.contentX() + layout.contentWidth()) {
return false;
}
ContentList rows = contentList(layout);
int moduleIndex = rows.moduleIndexAt(mouseY);
if (moduleIndex < 0) {
return false;
}
Module module = rows.modules().get(moduleIndex);
if (button == 0) {
module.toggle();
} else if (button == 1 && ClickGuiModules.hasSettings(module)) {
settingsModule = module;
scrollOffset = 0.0f;
}
return true;
}
private boolean handleSettingsClick(ClickGuiLayout layout, float mouseX,
float mouseY, int button) {
if (button == 0 && SettingsSection.isBackButton(layout, mouseX,
mouseY)) {
closeSettings();
return true;
}
List<Value<?>> settings = settingsOf();
int index = SettingsSection.rowIndexAt(layout, settings, scrollOffset,
mouseY);
if (index >= 0) {
SettingsSection.click(settings, index, button);
return true;
}
return false;
}
private void closeSettings() {
settingsModule = null;
scrollOffset = 0.0f;
}
private ModuleCategory categoryAt(ClickGuiLayout layout, float mouseX,
float mouseY) {
float rowX = layout.categoryRowX();
@@ -205,6 +231,39 @@ public final class MainPanel extends Component {
screenWidth, screenHeight);
}
private ContentList contentList(ClickGuiLayout layout) {
return new ContentList(layout, modulesOf(selectedCategory),
scrollOffset);
}
private List<Value<?>> settingsOf() {
return settingsModule == null
? Collections.<Value<?>>emptyList()
: ClickGuiModules.settingsOf(settingsModule);
}
/**
* Applies this frame's wheel input to whichever list is visible and keeps
* its offset inside the content.
*/
private void applyScroll(ClickGuiLayout layout) {
double wheel = ClientInput.consumeScroll();
float step = (float) -wheel * SCROLL_STEP;
if (settingsModule != null) {
scrollOffset = ClickGuiStyle.clamp(scrollOffset + step, 0.0f,
SettingsSection.maxScroll(layout, settingsOf()));
return;
}
ContentList rows = contentList(layout);
if (wheel != 0.0) {
rows.scrollBy(step);
}
rows.clampScroll();
scrollOffset = rows.scroll();
}
private void updateBounds(Render2D graphics) {
screenWidth = graphics.getWidth();
screenHeight = graphics.getHeight();
@@ -0,0 +1,217 @@
package cn.xiaozhou233.orangex.ui.clickgui;
import cn.xiaozhou233.orangex.modules.Module;
import cn.xiaozhou233.orangex.render.api.FontRenderer;
import cn.xiaozhou233.orangex.render.api.Render2D;
import cn.xiaozhou233.orangex.value.BooleanValue;
import cn.xiaozhou233.orangex.value.ModeValue;
import cn.xiaozhou233.orangex.value.Value;
import java.util.List;
/**
* The settings page shown in the content area of {@link MainPanel}.
*
* <p>Opening a module's settings replaces the module list instead of spawning a
* separate window. The page keeps the list's scroll viewport and is left with
* the back button drawn next to the module name.</p>
*/
public final class SettingsSection {
/** Height of one settings row. */
public static final float ROW_HEIGHT = 22f;
private static final float BACK_SIZE = 16f;
private static final float BACK_GAP = 6f;
private static final Object BACK_HOVER_KEY = new Object();
private SettingsSection() {
}
/**
* @return the total height of the rows, which may exceed the visible list.
*/
public static float contentHeight(List<Value<?>> settings) {
return settings.size() * ROW_HEIGHT;
}
public static float maxScroll(ClickGuiLayout layout, List<Value<?>> settings) {
return Math.max(0.0f,
contentHeight(settings)
- (layout.listBottom() - layout.listTop()));
}
public static void draw(Render2D graphics, ClickGuiLayout layout,
Module module, List<Value<?>> settings, float scroll,
ClickGuiAnimator animator, float delta,
double mouseX, double mouseY) {
float contentX = layout.contentX();
float contentWidth = layout.contentWidth();
float headerY = layout.y() + ClickGuiStyle.HEADER_HEIGHT;
drawBackButton(graphics, layout, animator, delta, mouseX, mouseY);
FontRenderer title = ClickGuiStyle.font(graphics, 13.0f, true);
title.drawString(module.getName(),
contentX + BACK_SIZE + BACK_GAP + 4,
headerY + 10, ClickGuiStyle.COLOR_TEXT);
FontRenderer meta = ClickGuiStyle.font(graphics, 8.0f);
String metaText = "SETTINGS";
meta.drawString(metaText,
contentX + contentWidth - meta.getStringWidth(metaText),
headerY + 14, ClickGuiStyle.COLOR_TEXT_MUTED);
graphics.fillRect(contentX, headerY + 30, contentWidth, 1,
ClickGuiStyle.COLOR_DIVIDER);
float listTop = layout.listTop();
float listBottom = layout.listBottom();
graphics.enableScissor(contentX - 2, listTop - 2,
contentWidth + 4, listBottom - listTop + 4);
float rowY = listTop - scroll;
for (Value<?> value : settings) {
if (rowY + ROW_HEIGHT >= listTop && rowY <= listBottom) {
drawRow(graphics, layout, value, rowY, animator, delta,
mouseX, mouseY);
}
rowY += ROW_HEIGHT;
}
graphics.disableScissor();
ClickGuiStyle.drawScrollbar(graphics, contentX + contentWidth - 3,
listTop, listBottom - listTop, contentHeight(settings), scroll);
}
private static void drawBackButton(Render2D graphics, ClickGuiLayout layout,
ClickGuiAnimator animator, float delta,
double mouseX, double mouseY) {
float backX = layout.contentX();
float backY = backTop(layout);
boolean hovered = ClickGuiStyle.isInside(mouseX, mouseY, backX, backY,
BACK_SIZE, BACK_SIZE);
float hover = animator.hover(BACK_HOVER_KEY, hovered, delta);
if (hover > 0.01f) {
graphics.fillRoundedRect(backX, backY, BACK_SIZE, BACK_SIZE, 4,
ClickGuiStyle.argb((int) (22.0f * hover),
ClickGuiStyle.COLOR_ACCENT_RGB));
}
FontRenderer arrow = ClickGuiStyle.font(graphics, 9.0f, true);
arrow.drawCenteredString("<", backX + BACK_SIZE / 2.0,
ClickGuiStyle.centeredY(arrow, backY, BACK_SIZE),
hovered ? ClickGuiStyle.COLOR_ACCENT
: ClickGuiStyle.COLOR_TEXT_MUTED);
}
private static void drawRow(Render2D graphics, ClickGuiLayout layout,
Value<?> value, float rowY,
ClickGuiAnimator animator, float delta,
double mouseX, double mouseY) {
float rowLeft = layout.contentX();
float rowWidth = layout.contentWidth();
boolean hovered = mouseY >= layout.listTop()
&& mouseY <= layout.listBottom()
&& ClickGuiStyle.isInside(mouseX, mouseY, rowLeft, rowY,
rowWidth, ROW_HEIGHT);
float hover = animator.hover(value, hovered, delta);
if (hover > 0.01f) {
graphics.fillRoundedRect(rowLeft, rowY, rowWidth, ROW_HEIGHT, 4,
ClickGuiStyle.argb((int) (10.0f * hover), 0x00FFFFFF));
}
FontRenderer label = ClickGuiStyle.font(graphics, 9.0f);
label.drawString(value.getName(), rowLeft + 8,
ClickGuiStyle.centeredY(label, rowY, ROW_HEIGHT),
ClickGuiStyle.COLOR_TEXT_DIM);
float right = rowLeft + rowWidth - 8;
if (value instanceof BooleanValue) {
BooleanValue booleanValue = (BooleanValue) value;
float toggleWidth = ClickGuiStyle.SMALL_TOGGLE_WIDTH;
float toggleHeight = ClickGuiStyle.SMALL_TOGGLE_HEIGHT;
ClickGuiStyle.drawSwitch(graphics,
right - toggleWidth,
rowY + (ROW_HEIGHT - toggleHeight) / 2.0f,
toggleWidth, toggleHeight,
animator.state(value, booleanValue.isEnabled(), delta));
} else if (value instanceof ModeValue) {
ModeValue modeValue = (ModeValue) value;
FontRenderer modeFont = ClickGuiStyle.font(graphics, 9.0f);
String text = "< " + modeValue.getMode() + " >";
double pillWidth = modeFont.getStringWidth(text) + 10;
double pillX = right - pillWidth;
graphics.fillRoundedRect(pillX, rowY + 4, pillWidth,
ROW_HEIGHT - 8, 4,
ClickGuiStyle.argb(16, 0x00FFFFFF));
modeFont.drawString(text, pillX + 5,
ClickGuiStyle.centeredY(modeFont, rowY, ROW_HEIGHT),
ClickGuiStyle.COLOR_ACCENT);
} else {
FontRenderer valueFont = ClickGuiStyle.font(graphics, 9.0f);
String text = String.valueOf(value.getValue());
valueFont.drawString(text, right - valueFont.getStringWidth(text),
ClickGuiStyle.centeredY(valueFont, rowY, ROW_HEIGHT),
ClickGuiStyle.COLOR_TEXT_MUTED);
}
}
public static boolean isBackButton(ClickGuiLayout layout, double mouseX,
double mouseY) {
return ClickGuiStyle.isInside(mouseX, mouseY, layout.contentX(),
backTop(layout), BACK_SIZE, BACK_SIZE);
}
/**
* @return the index of the settings row under {@code mouseY}, or {@code -1}
* when the pointer is between rows.
*/
public static int rowIndexAt(ClickGuiLayout layout,
List<Value<?>> settings, float scroll,
float mouseY) {
if (mouseY < layout.listTop() || mouseY > layout.listBottom()) {
return -1;
}
float local = mouseY - (layout.listTop() - scroll);
int index = (int) Math.floor(local / ROW_HEIGHT);
return index >= 0 && index < settings.size() ? index : -1;
}
/**
* Applies a click to one settings row. Left-click toggles or advances,
* right-click steps a mode back; other value types are display-only.
*/
public static void click(List<Value<?>> settings, int index, int button) {
if (index < 0 || index >= settings.size()) {
return;
}
if (button != 0 && button != 1) {
return;
}
Value<?> value = settings.get(index);
if (value instanceof BooleanValue) {
if (button == 0) {
((BooleanValue) value).toggle();
}
} else if (value instanceof ModeValue) {
if (button == 0) {
((ModeValue) value).next();
} else {
((ModeValue) value).previous();
}
}
}
private static float backTop(ClickGuiLayout layout) {
return layout.y() + ClickGuiStyle.HEADER_HEIGHT + 8.0f;
}
}
@@ -1,263 +0,0 @@
package cn.xiaozhou233.orangex.ui.clickgui;
import cn.xiaozhou233.orangex.modules.Module;
import cn.xiaozhou233.orangex.render.api.FontRenderer;
import cn.xiaozhou233.orangex.render.api.Render2D;
import cn.xiaozhou233.orangex.value.BooleanValue;
import cn.xiaozhou233.orangex.value.ModeValue;
import cn.xiaozhou233.orangex.value.Value;
import java.util.List;
/**
* A small draggable window that shows the settings of one module.
*
* <p>Opened by right-clicking a module row in {@link MainPanel}. Clicking
* outside the window, pressing its close button or closing the GUI dismisses
* it.</p>
*/
public final class SettingsWindow {
private static final Object CLOSE_HOVER_KEY = new Object();
private static final float WIDTH = 236f;
private static final float HEADER_HEIGHT = 30f;
private static final float ROW_HEIGHT = 22f;
private static final float BODY_PADDING = 8f;
private static final float RADIUS = 7f;
private static final float CLOSE_SIZE = 16f;
private final ClickGuiAnimator animator = new ClickGuiAnimator();
private Module module;
private List<Value<?>> settings;
private float x;
private float y;
private float width;
private float height;
private int screenWidth = 854;
private int screenHeight = 480;
private boolean dragging;
private float dragOffsetX;
private float dragOffsetY;
public boolean isOpen() {
return module != null;
}
public void open(Module module, ClickGuiLayout layout) {
List<Value<?>> moduleSettings = ClickGuiModules.settingsOf(module);
if (moduleSettings.isEmpty()) {
close();
return;
}
this.module = module;
this.settings = moduleSettings;
this.width = WIDTH;
this.height = HEADER_HEIGHT + BODY_PADDING * 2.0f
+ moduleSettings.size() * ROW_HEIGHT;
this.screenWidth = layout.screenWidth();
this.screenHeight = layout.screenHeight();
this.dragging = false;
this.x = layout.x() + (layout.width() - width) / 2.0f;
this.y = layout.y() + (layout.height() - height) / 2.0f;
this.x = ClickGuiStyle.clamp(x, 4.0f,
Math.max(4.0f, screenWidth - width - 4.0f));
this.y = ClickGuiStyle.clamp(y, 4.0f,
Math.max(4.0f, screenHeight - height - 4.0f));
this.x = Math.round(x);
this.y = Math.round(y);
}
public void close() {
module = null;
settings = null;
dragging = false;
}
public void render(Render2D graphics, float delta,
double mouseX, double mouseY) {
if (!isOpen()) {
return;
}
graphics.fillRoundedRect(x - 3, y + 2, width + 6, height + 4,
RADIUS + 3, 0x26000000);
graphics.fillRoundedRect(x, y, width, height, RADIUS, 1.0,
ClickGuiStyle.COLOR_PANEL, ClickGuiStyle.COLOR_BORDER);
FontRenderer title = ClickGuiStyle.font(graphics, 11.0f, true);
title.drawString(module.getName(), x + 12, y + 7,
ClickGuiStyle.COLOR_TEXT);
FontRenderer subtitle = ClickGuiStyle.font(graphics, 7.0f, true);
subtitle.drawString("SETTINGS", x + 12, y + 19,
ClickGuiStyle.COLOR_TEXT_MUTED);
drawCloseButton(graphics, delta, mouseX, mouseY);
graphics.fillRect(x + 10, y + HEADER_HEIGHT - 1, width - 20, 1,
ClickGuiStyle.COLOR_DIVIDER);
float rowY = y + HEADER_HEIGHT + BODY_PADDING;
for (Value<?> value : settings) {
drawSettingRow(graphics, value, rowY, delta, mouseX, mouseY);
rowY += ROW_HEIGHT;
}
}
private void drawCloseButton(Render2D graphics, float delta,
double mouseX, double mouseY) {
float closeX = x + width - 12 - CLOSE_SIZE;
float closeY = y + (HEADER_HEIGHT - CLOSE_SIZE) / 2.0f;
boolean hovered = ClickGuiStyle.isInside(mouseX, mouseY, closeX,
closeY, CLOSE_SIZE, CLOSE_SIZE);
float hover = animator.hover(CLOSE_HOVER_KEY, hovered, delta);
if (hover > 0.01f) {
graphics.fillRoundedRect(closeX, closeY, CLOSE_SIZE, CLOSE_SIZE,
4, ClickGuiStyle.argb((int) (22.0f * hover),
ClickGuiStyle.COLOR_ACCENT_RGB));
}
FontRenderer close = ClickGuiStyle.font(graphics, 9.0f, true);
close.drawCenteredString("x", closeX + CLOSE_SIZE / 2.0,
closeY + (CLOSE_SIZE - close.getStringHeight()) / 2.0,
hovered ? ClickGuiStyle.COLOR_ACCENT
: ClickGuiStyle.COLOR_TEXT_MUTED);
}
private void drawSettingRow(Render2D graphics, Value<?> value, float rowY,
float delta, double mouseX, double mouseY) {
boolean hovered = ClickGuiStyle.isInside(mouseX, mouseY, x + 6, rowY,
width - 12, ROW_HEIGHT);
float hover = animator.hover(value, hovered, delta);
if (hover > 0.01f) {
graphics.fillRoundedRect(x + 6, rowY, width - 12, ROW_HEIGHT, 4,
ClickGuiStyle.argb((int) (10.0f * hover), 0x00FFFFFF));
}
FontRenderer label = ClickGuiStyle.font(graphics, 9.0f);
label.drawString(value.getName(), x + 14,
ClickGuiStyle.centeredY(label, rowY, ROW_HEIGHT),
ClickGuiStyle.COLOR_TEXT_DIM);
float right = x + width - 12;
if (value instanceof BooleanValue) {
BooleanValue booleanValue = (BooleanValue) value;
float toggleWidth = ClickGuiStyle.SMALL_TOGGLE_WIDTH;
float toggleHeight = ClickGuiStyle.SMALL_TOGGLE_HEIGHT;
ClickGuiStyle.drawSwitch(graphics,
right - toggleWidth,
rowY + (ROW_HEIGHT - toggleHeight) / 2.0f,
toggleWidth, toggleHeight,
animator.state(value, booleanValue.isEnabled(), delta));
} else if (value instanceof ModeValue) {
ModeValue modeValue = (ModeValue) value;
FontRenderer modeFont = ClickGuiStyle.font(graphics, 9.0f);
String text = "< " + modeValue.getMode() + " >";
double pillWidth = modeFont.getStringWidth(text) + 10;
double pillX = right - pillWidth;
graphics.fillRoundedRect(pillX, rowY + 3, pillWidth,
ROW_HEIGHT - 6, 4,
ClickGuiStyle.argb(16, 0x00FFFFFF));
modeFont.drawString(text, pillX + 5,
ClickGuiStyle.centeredY(modeFont, rowY, ROW_HEIGHT),
ClickGuiStyle.COLOR_ACCENT);
} else {
FontRenderer valueFont = ClickGuiStyle.font(graphics, 9.0f);
String text = String.valueOf(value.getValue());
valueFont.drawString(text, right - valueFont.getStringWidth(text),
ClickGuiStyle.centeredY(valueFont, rowY, ROW_HEIGHT),
ClickGuiStyle.COLOR_TEXT_MUTED);
}
}
/**
* @return {@code true} when the click was inside the window (and has been
* consumed), {@code false} when the caller should dismiss it.
*/
public boolean mouseClicked(float mouseX, float mouseY, int button) {
if (!isOpen()
|| !ClickGuiStyle.isInside(mouseX, mouseY, x, y,
width, height)) {
return false;
}
float closeX = x + width - 12 - CLOSE_SIZE;
float closeY = y + (HEADER_HEIGHT - CLOSE_SIZE) / 2.0f;
if (button == 0 && ClickGuiStyle.isInside(mouseX, mouseY, closeX,
closeY, CLOSE_SIZE, CLOSE_SIZE)) {
close();
return true;
}
if (ClickGuiStyle.isInside(mouseX, mouseY, x, y,
width, HEADER_HEIGHT)) {
if (button == 0) {
dragging = true;
dragOffsetX = mouseX - x;
dragOffsetY = mouseY - y;
}
return true;
}
float rowY = y + HEADER_HEIGHT + BODY_PADDING;
for (Value<?> value : settings) {
if (ClickGuiStyle.isInside(mouseX, mouseY, x + 6, rowY,
width - 12, ROW_HEIGHT)) {
applySetting(value, button);
return true;
}
rowY += ROW_HEIGHT;
}
return true;
}
public void mouseDragged(float mouseX, float mouseY, int button) {
if (!isOpen() || !dragging || button != 0) {
return;
}
x = ClickGuiStyle.clamp(mouseX - dragOffsetX, 4.0f,
Math.max(4.0f, screenWidth - width - 4.0f));
y = ClickGuiStyle.clamp(mouseY - dragOffsetY, 4.0f,
Math.max(4.0f, screenHeight - height - 4.0f));
x = Math.round(x);
y = Math.round(y);
}
public void mouseReleased(float mouseX, float mouseY, int button) {
if (button == 0) {
dragging = false;
}
}
private void applySetting(Value<?> value, int button) {
if (button != 0 && button != 1) {
return;
}
if (value instanceof BooleanValue) {
if (button == 0) {
((BooleanValue) value).toggle();
}
} else if (value instanceof ModeValue) {
ModeValue modeValue = (ModeValue) value;
if (button == 0) {
modeValue.next();
} else {
modeValue.previous();
}
}
}
}
@@ -16,7 +16,21 @@ public interface WorldView {
/**
* Captures the camera and entity list for the current frame.
*
* @param partialTicks the partial tick the game rendered this frame with,
* taken from {@code EventRender2D}. This is the only
* value that keeps projections aligned with the
* rendered world; {@link Float#NaN} lets the
* implementation resolve one itself.
* @return {@code null} while no level is loaded (title screen, loading).
*/
WorldSnapshot snapshot();
WorldSnapshot snapshot(float partialTicks);
/**
* @return whether a caller-supplied frame partial tick can be used. NaN and
* out-of-range values are rejected so a misbehaving hook never
* freezes entity interpolation.
*/
static boolean isUsablePartialTick(float partialTicks) {
return partialTicks >= 0.0F && partialTicks <= 1.0F;
}
}
@@ -73,6 +73,7 @@ public final class V1_8_9WorldView implements WorldView {
private final String[] villagerClassNames;
private Field partialTicksField;
private boolean partialTicksWarningLogged;
private Field loadedEntitiesField;
private Field thirdPersonViewField;
private Field fovSettingField;
@@ -116,7 +117,7 @@ public final class V1_8_9WorldView implements WorldView {
}
@Override
public WorldSnapshot snapshot() {
public WorldSnapshot snapshot(float partialTicks) {
Object world = ReflectionSupport.get(worldField, minecraft);
Object viewEntity = ReflectionSupport.get(viewEntityField, minecraft);
Object localPlayer = ReflectionSupport.get(playerField, minecraft);
@@ -125,18 +126,23 @@ public final class V1_8_9WorldView implements WorldView {
return null;
}
float partialTicks = partialTicks();
// The render hook hands us the exact value the frame was rendered
// with. Only fall back to the timer when the caller has none, because a
// partial tick of 0 (or a stale one) makes every interpolated position
// advance in 20 Hz steps while the world renders smoothly.
float frameTicks = WorldView.isUsablePartialTick(partialTicks)
? partialTicks : partialTicks();
EntityAccess view = accessFor(viewEntity.getClass());
double eyeX = interpolate(view.posX, view.lastTickPosX, viewEntity, partialTicks);
double eyeY = interpolate(view.posY, view.lastTickPosY, viewEntity, partialTicks)
double eyeX = interpolate(view.posX, view.lastTickPosX, viewEntity, frameTicks);
double eyeY = interpolate(view.posY, view.lastTickPosY, viewEntity, frameTicks)
+ invokeFloat(view.eyeHeight, viewEntity);
double eyeZ = interpolate(view.posZ, view.lastTickPosZ, viewEntity, partialTicks);
double eyeZ = interpolate(view.posZ, view.lastTickPosZ, viewEntity, frameTicks);
float yaw = interpolateAngle(view.rotationYaw, view.prevRotationYaw,
viewEntity, partialTicks);
viewEntity, frameTicks);
float pitch = interpolateAngle(view.rotationPitch, view.prevRotationPitch,
viewEntity, partialTicks);
viewEntity, frameTicks);
int thirdPerson = thirdPersonView();
float cameraYaw = yaw;
@@ -152,7 +158,7 @@ public final class V1_8_9WorldView implements WorldView {
// Third person moves the camera back by the configured distance;
// first person sits 0.1 blocks behind the eye (EntityRenderer).
double cameraOffset = thirdPerson > 0
? thirdPersonDistance(partialTicks)
? thirdPersonDistance(frameTicks)
: FIRST_PERSON_OFFSET;
double yawRadians = Math.toRadians(cameraYaw);
@@ -166,9 +172,9 @@ public final class V1_8_9WorldView implements WorldView {
double cameraY = eyeY - forwardY * cameraOffset;
double cameraZ = eyeZ - forwardZ * cameraOffset;
float fov = fieldOfView(partialTicks);
float fov = fieldOfView(frameTicks);
List<EntityTarget> targets = collectTargets(
world, localPlayer, cameraX, cameraY, cameraZ, partialTicks);
world, localPlayer, cameraX, cameraY, cameraZ, frameTicks);
return new WorldSnapshot(new Vec3(cameraX, cameraY, cameraZ),
cameraYaw, cameraPitch, fov, targets);
@@ -292,6 +298,12 @@ public final class V1_8_9WorldView implements WorldView {
if (partialTicksField == null) {
partialTicksField = ReflectionSupport.findField(
timer.getClass(), partialTicksName);
if (partialTicksField == null && !partialTicksWarningLogged) {
partialTicksWarningLogged = true;
System.err.println("[OrangeX] Cannot read "
+ partialTicksName + " from " + timer.getClass().getName()
+ ": world positions will not interpolate");
}
}
return partialTicksField == null
@@ -86,7 +86,7 @@ public final class V26_2WorldView implements WorldView {
}
@Override
public WorldSnapshot snapshot() {
public WorldSnapshot snapshot(float partialTicks) {
Object level = ReflectionSupport.get(levelField, minecraft);
Object localPlayer = ReflectionSupport.get(playerField, minecraft);
Object gameRenderer = ReflectionSupport.get(gameRendererField, minecraft);
@@ -95,12 +95,17 @@ public final class V26_2WorldView implements WorldView {
return null;
}
float partialTicks = partialTicks();
Object camera = camera(gameRenderer);
if (camera == null) {
return null;
}
// The 26.2 hook extracts the GUI from the game's delta tracker, so it
// supplies no partial tick and the tracker is the authoritative value.
if (!WorldView.isUsablePartialTick(partialTicks)) {
partialTicks = partialTicks();
}
Vec3 cameraPosition = readVec3(
ReflectionSupport.invoke(cameraPositionMethod, camera));
float yaw = invokeFloat(cameraYRotMethod, camera);
@@ -30,6 +30,15 @@ public final class Hooks {
Render2DEvents.fire(context, inWorld);
}
/**
* 1.8.9 entry point: the HUD method receives the frame's partial tick, so
* injected code passes it straight through as {@code $1}.
*/
public static void render2d(Object context, boolean inWorld,
float partialTicks) {
Render2DEvents.fire(context, inWorld, partialTicks);
}
public static void render2d(Object context) {
Render2DEvents.fire(context);
}
@@ -14,6 +14,10 @@ public final class Legacy {
return V1_8_9Input.isRepeatEvent();
}
public static void forwardScroll(Object screen) {
V1_8_9Input.forwardScroll(screen);
}
private Legacy() {
}
}
+158 -7
View File
@@ -1,10 +1,161 @@
# OrangeX Client
## 项目重构中, Legacy版本请移步 [OrangeX-Client-Legacy](https://github.com/xiaozhou233/OrangeX-Client-Legacy)
## Project is being refactored, Legacy version please refer to [OrangeX-Client-Legacy](https://github.com/xiaozhou233/OrangeX-Client-Legacy)
![Banner](docs/img/banner2.png)
## 支持注入的版本
| Minecraft Version | Vanilla | Forge | Fabric | Badlion Client | MCP |
|:-----------------:|:-------:|:-----:|:------:|:--------------:|:---:|
| 1.8.9 | ✓ | ✓ | — | ✓ | ✓ |
| 26.2 | ✓ | ✗ | ✓ | — | — |
> [!WARNING]
> **项目重构中 / Under Refactoring**
>
> 当前 `main` 分支为重构版本,项目架构、API 和功能仍在持续调整中,暂不保证向后兼容。
>
> The `main` branch contains the rewritten client. Its architecture, APIs, and features are still evolving and may change without notice.
>
> 旧版本请访问:[OrangeX-Client-Legacy](https://github.com/xiaozhou233/OrangeX-Client-Legacy)
## 项目介绍 | Introduction
OrangeX Client 是一个面向 Minecraft 的注入式辅助客户端
OrangeX Client is an injection-based Minecraft utility client
## 支持的版本 | Compatibility
以下表格列出了目前已验证的 Minecraft 版本与运行环境组合。
| Minecraft Version | Vanilla | Forge | Fabric | Badlion Client | Lunar Client | MCP |
|:-----------------:|:-------:|:-----:|:------:|:--------------:|:------------:|:---:|
| 1.8.9 | ✓ | ✓ | — | ✓ | ✓ | ✓ |
| 26.2 | ✓ | ✗ | ✓ | — | — | — |
**状态说明:**
- ✓ Supported:已支持并验证
- ✗ Unsupported:已验证不支持
- — N/A / Untested:环境不存在或尚未完成测试
> 兼容性信息仅反映已经验证的组合,不代表其他未列出的环境一定不兼容。
## 下载 | Downloads
### Stable Releases
正式发布版本可从 GitHub Releases 获取:
[OrangeX Client Releases](https://github.com/xiaozhou233/OrangeX-Client/releases)
### Development Builds
开发版本由 Jenkins 自动构建并发布:
[Jenkins - OrangeX Client](https://jenkins.xiaozhou233.cn/job/OrangeX-Client/)
> [!NOTE]
> 开发版本可能包含未完成的功能、实验性接口或尚未修复的问题,不建议在生产环境中使用。
## 构建 | Building
### 环境要求 | Requirements
| 环境 | 要求 |
|---|---|
| Java | 25 |
| Network | 需要网络连接以下载构建依赖 |
| Build Tool | Gradle Wrapper(项目自带) |
### 开始构建 | Build
克隆项目后,在项目根目录执行:
```bash
./gradlew packageAll
```
Windows 环境:
```bat
gradlew.bat packageAll
```
> [!IMPORTANT]
> `build` 任务被有意禁用。请使用 `packageAll` 进行完整构建。
>
> The `build` task is intentionally disabled. Use `packageAll` instead.
### 构建产物 | Artifacts
构建完成后,产物将输出到 `out/` 目录。
| 路径 | 说明 |
|---|---|
| `out/injection.zip` | 完整注入包,包含 Loader、OrangeX、原生 DLL 和配置文件 |
| `out/injector.jar` | 图形化注入器,内置 FlatLaf |
| `out/tmp/` | 打包过程中生成的临时文件 |
首次构建时,Gradle 会自动下载所需依赖并保存到 `libraries/` 目录。
如果依赖下载失败,请检查网络连接及代理配置。
## 使用指南 | Usage
### 1. 获取程序
选择以下任意一种方式获取 OrangeX Client:
- [GitHub Releases](https://github.com/xiaozhou233/OrangeX-Client/releases)
- [Jenkins Development Builds](https://jenkins.xiaozhou233.cn/job/OrangeX-Client/)
- 自行构建,参见 [构建指南](#构建--building)
### 2. 启动注入器
```bash
java -jar injector.jar
```
### 4. 执行注入
在图形化注入器中选择目标 Minecraft 进程,并按照界面提示完成注入。
## 开发指南 | Development
### 开发环境 | Requirements
| 环境 | 要求 |
|---------|-------------------------------------------|
| Java | 25 |
| IDE | IntelliJ IDEA 2026.2.3 或更高版本(推荐) |
| Git | 用于版本控制 |
| Network | 需要网络连接 |
### 初始化项目 | Setup
**1. 克隆仓库**
```bash
git clone https://github.com/xiaozhou233/OrangeX-Client.git
cd OrangeX-Client
```
**2. 使用 IntelliJ IDEA 打开项目**
等待 Gradle 同步及依赖下载完成。
**3. 准备 Minecraft 开发环境**
加入项目 QQ 群 1103504356,从群文件下载 `Minecraft1.8.8.zip`。
将压缩包解压到`Minecraft1.8.8/`目录,确保目录中有`src/`和`runtime/`
**4. 开始开发**
根据需要修改对应模块的代码。
**5. 运行客户端**
使用 IntelliJ IDEA 中配置好的运行配置启动 Minecraft 客户端。
![Start Client](docs/img/start-client.png)
## 其他 | Others
- 项目仍处于积极重构阶段,部分功能和接口可能发生变化。
- 欢迎提交 Issue 和 Pull Request。
- 使用过程中遇到问题,可以通过项目 Issue 或 QQ 群反馈。
Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB