Skip to content
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
11 changes: 7 additions & 4 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@
"Bash(wc *)",
"Bash(which *)",
"Bash(echo *)",

"Bash(grep:*)",
"Bash(grep *)",
"Bash(find:*)",
"Bash(find *)",
"Bash(sort:*)",
"Bash(sort *)",

"Bash(curl *)",
"Bash(javap *)",
"Bash(python3 *)",
"Bash(./gradlew *)"

"Bash(./gradlew *)",
"Bash(mkdir -p ~/.claude/plugins/cache/local/minecraft-claude/1.0.0)",
"Bash(rmdir ~/.claude/plugins/cache/local/minecraft-claude/1.0.0)",
"Bash(ln -s /mnt/h/Repo/MinecraftClaude ~/.claude/plugins/cache/local/minecraft-claude/1.0.0)",
"Read(//home/local/.claude/plugins/cache/local/**)",
"Read(//mnt/h/Repo/**)",
"Bash(ls -la ../)"
]
},
"defaultMode": "bypassPermissions"
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/modrinth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,19 @@ jobs:
fabric-api
modmenu
yacl

- name: Publish 26.3
uses: BreadMoirai/mc-publish@master
with:
modrinth-token: ${{ secrets.M_TOKEN }}
files: build/libs/${{ env.MOD_VERSION }}/one-click-crafting-${{ env.MOD_VERSION }}+26.3*.jar
name: "${{ env.MOD_VERSION }}+26.3"
version: "${{ env.MOD_VERSION }}+26.3"
version-type: release
loaders: fabric
game-versions: "26.3"
java: 25
dependencies: |
fabric-api
modmenu
yacl
24 changes: 12 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ tasks {
}
}

withType<JavaCompile> {
options.encoding = "UTF-8"
}

withType<Test> {
failOnNoDiscoveredTests = false
}

// Builds the version into a shared folder in `build/libs/${mod version}/`
register<Copy>("buildAndCollect") {
withType<JavaCompile> {
options.encoding = "UTF-8"
}
withType<Test> {
failOnNoDiscoveredTests = false
}
// Builds the version into a shared folder in `build/libs/${mod version}/`
register<Copy>("buildAndCollect") {
group = "build"
from(remapJar.map { it.archiveFile }, remapSourcesJar.map { it.archiveFile })
into(rootProject.layout.buildDirectory.file("libs/${project.property("mod.version")}"))
Expand Down Expand Up @@ -102,7 +102,7 @@ if (sc.current.parsed < "26") {
tasks.withType<JavaCompile>().configureEach { dependsOn(transformForBuild) }
}

val hasClientGameTestApi = property("minecraft_version").toString() >= "1.21.4"
val hasClientGameTestApi = sc.current.parsed >= "1.21.4"

sourceSets {
named("test") {
Expand Down Expand Up @@ -152,4 +152,4 @@ stonecutter {
}
}
}
}
}
11 changes: 11 additions & 0 deletions build.unobf.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ loom {
}

runs {
// MC 26.x on Windows (JDK 25+): pre-commit each thread's whole stack at thread start.
// Without this, ~10-50% of client launches die in the first resource reload with
// NTSTATUS 0xC0000005 / 0xC0000409 and no hs_err file: JIT-compiled code on a
// Worker-Main thread stack-bangs past the Windows guard page, HotSpot's Windows fault
// handler commits the stack range manually (leaving no guard page below it), and VM
// call-site resolution (SharedRuntime::find_callee_*) then runs off the committed
// region or corrupts its own frame. Pre-touching avoids that path entirely.
// Verified 0/40 crashes vs 5/40+ without; see the update skill api-divergences.md.
configureEach {
vmArgs("-XX:+UnlockDiagnosticVMOptions", "-XX:+AlwaysPreTouchStacks")
}
register("TestClient") {
client()
name("Test Client")
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ plugins {
stonecutter {
create(rootProject) {
versions("1.21.11", "1.21.10", "1.21.9", "1.21.8", "1.21.7", "1.21.6", "1.21.5", "1.21.4", "1.21.3", "1.21.2", "1.21.1", "1.20.1")
versions("26.2", "26.1").buildscript("build.unobf.gradle.kts")
vcsVersion = "26.2"
versions("26.3", "26.2", "26.1").buildscript("build.unobf.gradle.kts")
vcsVersion = "26.3"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ public OneClickCraftingHandler(OneClickCraftingMod mod) {
public void onInitialize() {
OneClickEvents.RECIPE_CLICK.register(this);
OneClickEvents.RESULT_SLOT_UPDATE.register(this);
ScreenEvents.BEFORE_INIT.register((unused1, screen, unused2, unused3) -> {
ScreenEvents.BEFORE_INIT.register((_, screen, _, _) -> {
if (screen instanceof InventoryScreen || screen instanceof CraftingScreen) {
ScreenEvents.afterTick(screen).register(unused4 -> tick());
ScreenEvents.afterTick(screen).register(_ -> tick());
ScreenKeyboardEvents.beforeKeyPress(screen)
//$ if >= 1.21.9 '.register((screen2, key) -> {' else '.register((screen2, key, unused5, unused6) -> {'
.register((screen2, key, unused5, unused6) -> {
//$ if >= 1.21.9 '.register((screen2, key) -> {' else '.register((screen2, key, _, _) -> {'
.register((screen2, key) -> {
if (hasOp()) return;
//~ if >=1.21.9 'key' -> 'key.key()'
if (mod.input.repeatLast.guard(key)) return;
if (mod.input.repeatLast.guard(key.key())) return;
if (isRepeating) return;
isRepeating = true;
fireRepeatCraft();
});
ScreenEvents.remove(screen).register(unused9 -> clearOp());
ScreenEvents.remove(screen).register(_ -> clearOp());
}
});
}
Expand Down Expand Up @@ -70,8 +70,8 @@ protected void fireRepeatCraft() {
public void onResultSlotUpdate(OneClickItemStack stack) {
if (!hasOp()) {
debug("onResultSlotUpdate(crafting): no active operation, ignoring " + stack.count() + " " + stack.stack()
.getHoverName().getString(), () -> {
Screen screen = Minecraft.getInstance().screen;
.getItemName().getString(), () -> {
Screen screen = Minecraft.getInstance().gui.screen();
return screen instanceof InventoryScreen || screen instanceof CraftingScreen;
});
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public void onInitialize() {
if (screen instanceof StonecutterScreen) {
ScreenEvents.afterTick(screen).register(screen2 -> tick());
ScreenKeyboardEvents.beforeKeyPress(screen)
//$ if >= 1.21.9 '.register((screen2, key) -> {' else '.register((screen2, key, unused1, unused2) -> {'
.register((screen2, key, unused1, unused2) -> {
//$ if >= 1.21.9 '.register((screen2, key) -> {' else '.register((screen2, key, _, _) -> {'
.register((screen2, key) -> {
if (hasOp()) return;
//~ if >=1.21.9 'key' -> 'key.key()'
if (mod.input.repeatLast.guard(key)) return;
if (mod.input.repeatLast.guard(key.key())) return;
if (isRepeating) return;
isRepeating = true;
fireRepeatCraft();
Expand All @@ -53,8 +53,8 @@ protected void fireRepeatCraft() {
public void onResultSlotUpdate(OneClickItemStack stack) {
if (!hasOp()) {
debug("onResultSlotUpdate(stonecutter): no active operation, ignoring " + stack.count() + " " + stack.stack()
.getHoverName().getString(), () -> {
Screen screen = Minecraft.getInstance().screen;
.getItemName().getString(), () -> {
Screen screen = Minecraft.getInstance().gui.screen();
return screen instanceof StonecutterScreen;
});
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class OneClickCraftingConfig {
public static final boolean DEFAULT_DROP_ENABLE = true;
public static final int DEFAULT_REPEAT_DELAY = 6;
//~ if >= 1.21.9 '1' -> '0'
public static final int DEFAULT_REPEAT_INTERVAL = 1;
public static final int DEFAULT_REPEAT_INTERVAL = 0;
public static final boolean DEFAULT_DEBUG_LOGGING = false;
public static final int DEFAULT_TOGGLE_HOLD_KEYCODE = -1;
public static final int DEFAULT_REPEAT_LAST_KEYCODE = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ public void setBind(KeyMapping bind) {

@Override
public void setKey(int keycode) {
this.bind.setKey(InputConstants.Type.KEYSYM.getOrCreate(keycode));
this.bind.setKey(InputConstants.Type.KEYBOARD.getOrCreate(keycode));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.github.breadmoirai.oneclickcrafting.input;

import com.mojang.blaze3d.platform.InputConstants;

/**
* GUI mouse-button codes, and the mapping to this mod's internal button codes.
*
* <p>MC 26.3 replaced GLFW with SDL, which numbers mouse buttons differently
* (GLFW: left 0, right 1 - SDL: left 1, right 3). Always compare a
* {@code MouseButtonEvent}/{@code MouseButtonInfo} button against {@link #LEFT}/{@link #RIGHT}
* rather than a literal. The mod's own codes ({@code 0} left, {@code 1} right, {@code -1} drop -
* see {@code OneClickOperation}) are unrelated to the platform numbering and stay as they are.
*/
public final class MouseButtons {

public static final int LEFT = InputConstants.MOUSE_BUTTON_LEFT;
public static final int RIGHT = InputConstants.MOUSE_BUTTON_RIGHT;

private MouseButtons() {
}

/** Maps a platform GUI mouse-button code to the mod's internal code (0 = left, 1 = right). */
public static int toInternal(int guiButton) {
return guiButton == RIGHT ? 1 : 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

import com.mojang.blaze3d.platform.InputConstants;
import com.mojang.blaze3d.platform.Window;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import org.lwjgl.glfw.GLFW;
import net.minecraft.resources.Identifier;

import java.util.Arrays;
import java.util.List;

import static org.lwjgl.glfw.GLFW.GLFW_KEY_UNKNOWN;

public class OneClickCraftingInput {
public final DropBinding drop;
public final InputBindingImpl toggleHold;
Expand All @@ -31,40 +28,45 @@ public OneClickCraftingInput() {
public void registerBindings() {
List<InputBindingImpl> bindings = Arrays.asList(toggleHold, repeatLast);
//? >=1.21.9 {
/*ResourceLocation categoryId = ResourceLocation.fromNamespaceAndPath("oneclickcrafting", "keybindings");
Identifier categoryId = Identifier.fromNamespaceAndPath("oneclickcrafting", "keybindings");
KeyMapping.Category category = KeyMapping.Category.register(categoryId);
*///? }
//? }
for (InputBindingImpl binding : bindings) {
KeyMapping mapping = KeyBindingHelper.registerKeyBinding(new KeyMapping(
KeyMapping mapping = KeyMappingHelper.registerKeyMapping(new KeyMapping(
binding.getId(),
InputConstants.Type.KEYSYM,
GLFW_KEY_UNKNOWN,
InputConstants.Type.KEYBOARD,
InputConstants.UNKNOWN.getValue(),
//$ if >=1.21.9 'category' else '"key.category.oneclickcrafting.keybindings"'
"key.category.oneclickcrafting.keybindings"
category
));
binding.setBind(mapping);
}
}

public static boolean isKeyDown(int keycode) {
if (keycode == GLFW_KEY_UNKNOWN) return false;
if (keycode == InputConstants.UNKNOWN.getValue()) return false;
//? >=1.21.9 {
/*Window window = Minecraft.getInstance().getWindow();
*///? } else {
long window = Minecraft.getInstance().getWindow().getWindow();
//? }
return InputConstants.isKeyDown(window, keycode);
Window window = Minecraft.getInstance().getWindow();
//? } else {
/*long window = Minecraft.getInstance().getWindow().getWindow();
*///? }
// MC 26.3 (SDL) dropped the window argument; `window` is unused there.
//? if >=26.3 {
return InputConstants.isKeyDown(keycode);
//? } else {
/*return InputConstants.isKeyDown(window, keycode);
*///? }
}

public boolean isShiftDown() {
return isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT) || isKeyDown(GLFW.GLFW_KEY_RIGHT_SHIFT);
return isKeyDown(InputConstants.KEY_LSHIFT) || isKeyDown(InputConstants.KEY_RSHIFT);
}

public boolean isControlDown() {
return isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL) || isKeyDown(GLFW.GLFW_KEY_RIGHT_CONTROL);
return isKeyDown(InputConstants.KEY_LCONTROL) || isKeyDown(InputConstants.KEY_RCONTROL);
}

public boolean isAltDown() {
return isKeyDown(GLFW.GLFW_KEY_LEFT_ALT) || isKeyDown(GLFW.GLFW_KEY_RIGHT_ALT);
return isKeyDown(InputConstants.KEY_LALT) || isKeyDown(InputConstants.KEY_RALT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.function.Predicate;
import com.github.breadmoirai.oneclickcrafting.item.OneClickItemStack;
import com.github.breadmoirai.oneclickcrafting.inventory.v20_1.OneClickInventoryImpl;
import com.github.breadmoirai.oneclickcrafting.inventory.v26_1.OneClickInventoryImpl;

public abstract class OneClickInventory {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.breadmoirai.oneclickcrafting.inventory;

import net.minecraft.world.inventory.ClickType;
import net.minecraft.world.inventory.ContainerInput;

public enum OneClickInventoryAction {
PICKUP,
Expand All @@ -11,8 +11,8 @@ public enum OneClickInventoryAction {
QUICK_CRAFT,
PICKUP_ALL;

public ClickType mapping() {
return ClickType.valueOf(this.name());
public ContainerInput mapping() {
return ContainerInput.valueOf(this.name());
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//? <1.21.1 {
package com.github.breadmoirai.oneclickcrafting.inventory.v20_1;
/*package com.github.breadmoirai.oneclickcrafting.inventory.v26_1;

import com.github.breadmoirai.oneclickcrafting.inventory.OneClickInventory;
import com.github.breadmoirai.oneclickcrafting.inventory.OneClickInventoryAction;
Expand All @@ -17,7 +17,7 @@ public class OneClickInventoryImpl extends OneClickInventory {

private static AbstractContainerMenu getMenu() {
Minecraft minecraft = Minecraft.getInstance();
if (!(minecraft.screen instanceof AbstractContainerScreen<? extends AbstractContainerMenu> containerScreen))
if (!(minecraft.gui.screen() instanceof AbstractContainerScreen<? extends AbstractContainerMenu> containerScreen))
return null;
return containerScreen.getMenu();
}
Expand Down Expand Up @@ -52,4 +52,4 @@ public int findMatchingSlot(Predicate<OneClickItemStack> predicate) {
return -1;
}
}
//? }
*///? }
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//? >=1.21.1 <=1.21.11 {
/*package com.github.breadmoirai.oneclickcrafting.inventory.v20_1;
/*package com.github.breadmoirai.oneclickcrafting.inventory.v26_1;

import com.github.breadmoirai.oneclickcrafting.inventory.OneClickInventory;
import com.github.breadmoirai.oneclickcrafting.inventory.OneClickInventoryAction;
Expand All @@ -17,7 +17,7 @@ public class OneClickInventoryImpl extends OneClickInventory {

private static AbstractContainerMenu getMenu() {
Minecraft minecraft = Minecraft.getInstance();
if (!(minecraft.screen instanceof AbstractContainerScreen<? extends AbstractContainerMenu> containerScreen))
if (!(minecraft.gui.screen() instanceof AbstractContainerScreen<? extends AbstractContainerMenu> containerScreen))
return null;
return containerScreen.getMenu();
}
Expand Down
Loading
Loading