Skip to content

Commit 0853207

Browse files
committed
Ultralight test (FAILED)
1 parent 784c772 commit 0853207

17 files changed

Lines changed: 6368 additions & 0 deletions

File tree

build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ dependencies {
5656
// JSON parsing
5757
implementation 'com.google.code.gson:gson:2.10.1'
5858
include 'com.google.code.gson:gson:2.10.1'
59+
60+
// Ultralight HTML/CSS rendering engine (LWJGL bindings)
61+
// Note: Local JAR cannot use 'include' for jar-in-jar, will be bundled separately
62+
implementation files('libs/lwjgl-ultralight.jar')
5963
}
6064

6165
processResources {
@@ -88,6 +92,19 @@ jar {
8892
}
8993
}
9094

95+
// Copy Ultralight native libraries to run directory
96+
task copyUltralightNatives(type: Copy) {
97+
from 'natives/windows-x64'
98+
into 'run/natives'
99+
}
100+
101+
// Ensure natives are copied before running client
102+
tasks.named('runClient') {
103+
dependsOn copyUltralightNatives
104+
// Add native library path for Ultralight DLLs
105+
jvmArgs '-Djava.library.path=natives'
106+
}
107+
91108
// configure the maven publication
92109
publishing {
93110
publications {

libs/lwjgl-ultralight.jar

312 KB
Binary file not shown.

natives/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Ultralight Native Libraries Setup
2+
3+
The Ultralight HTML rendering engine requires native libraries (DLLs on Windows) to function.
4+
5+
## Download Instructions
6+
7+
1. Go to https://ultralig.ht/download/
8+
2. Download the **Ultralight SDK** for Windows x64
9+
3. Extract the archive
10+
4. Copy the following files from the SDK's `bin/` directory to `natives/windows-x64/`:
11+
- `Ultralight.dll`
12+
- `UltralightCore.dll`
13+
- `WebCore.dll`
14+
- `AppCore.dll`
15+
16+
5. Also copy the `resources/` folder from the SDK to `natives/windows-x64/resources/`
17+
This contains essential runtime files like:
18+
- `cacert.pem`
19+
- `icudt67l.dat`
20+
21+
## Directory Structure
22+
23+
After setup, your natives folder should look like:
24+
25+
```
26+
natives/
27+
├── README.md
28+
└── windows-x64/
29+
├── Ultralight.dll
30+
├── UltralightCore.dll
31+
├── WebCore.dll
32+
├── AppCore.dll
33+
└── resources/
34+
├── cacert.pem
35+
├── icudt67l.dat
36+
└── ...
37+
```
38+
39+
## Running the Mod
40+
41+
When running the Minecraft client with this mod, ensure the native library path includes the natives directory.
42+
43+
For development (runClient), the mod will automatically look for natives in the expected locations.
44+
45+
For production, the DLLs need to be bundled or placed in the Minecraft instance's native library path.
46+
47+
## Troubleshooting
48+
49+
If you see errors like "UnsatisfiedLinkError" or "Cannot load native library", ensure:
50+
1. All DLLs are present in the natives folder
51+
2. The resources folder is present
52+
3. You're using the correct architecture (x64)
53+
4. Visual C++ Redistributable 2019 or later is installed

natives/windows-x64/AppCore.dll

326 KB
Binary file not shown.

natives/windows-x64/Ultralight.dll

545 KB
Binary file not shown.
2.44 MB
Binary file not shown.

natives/windows-x64/WebCore.dll

40.3 MB
Binary file not shown.

natives/windows-x64/resources/cacert.pem

Lines changed: 3363 additions & 0 deletions
Large diffs are not rendered by default.
6.16 MB
Binary file not shown.

src/client/java/com/BookKeeper/InventoryNetwork/InventoryNetworkModClient.java

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22

33
import com.BookKeeper.InventoryNetwork.api.SchematicSyncApiImpl;
44
import com.BookKeeper.InventoryNetwork.api.SchematicSyncApiProvider;
5+
import com.BookKeeper.InventoryNetwork.ui.HelloWorldOverlay;
56
import com.BookKeeper.InventoryNetwork.ui.InventoryPanelOverlay;
7+
import com.BookKeeper.InventoryNetwork.ultralight.UltralightInventoryOverlay;
68
import net.fabricmc.api.ClientModInitializer;
9+
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
10+
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
11+
import net.minecraft.client.KeyMapping;
12+
import com.mojang.blaze3d.platform.InputConstants;
13+
import net.minecraft.resources.ResourceLocation;
14+
import org.lwjgl.glfw.GLFW;
715
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
816
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
917
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
@@ -55,6 +63,15 @@ public class InventoryNetworkModClient implements ClientModInitializer {
5563
// Tick counter for periodic tasks
5664
private int tickCounter = 0;
5765

66+
// Hello World overlay keybind
67+
private static KeyMapping helloWorldKey;
68+
69+
// Ultralight Inventory overlay keybind
70+
private static KeyMapping ultralightInventoryKey;
71+
72+
// Ultralight render mode toggle keybind
73+
private static KeyMapping ultralightRenderModeKey;
74+
5875
// Track if chest was open in previous tick (for detecting close)
5976
private boolean wasChestOpen = false;
6077

@@ -128,6 +145,43 @@ public void onInitializeClient() {
128145
// Register client tick event
129146
ClientTickEvents.END_CLIENT_TICK.register(this::onClientTick);
130147

148+
// Register Hello World keybind (H key)
149+
helloWorldKey = new KeyMapping(
150+
"key.inventorynetwork.helloworld",
151+
InputConstants.Type.KEYSYM,
152+
GLFW.GLFW_KEY_H,
153+
new KeyMapping.Category(ResourceLocation.fromNamespaceAndPath("inventorynetwork", "keys"))
154+
);
155+
KeyBindingHelper.registerKeyBinding(helloWorldKey);
156+
157+
// Register HUD render callback for Hello World overlay
158+
HudRenderCallback.EVENT.register((guiGraphics, tickCounter) -> {
159+
HelloWorldOverlay.render(guiGraphics);
160+
});
161+
162+
// Register Ultralight Inventory keybind (I key)
163+
ultralightInventoryKey = new KeyMapping(
164+
"key.inventorynetwork.ultralight_inventory",
165+
InputConstants.Type.KEYSYM,
166+
GLFW.GLFW_KEY_I,
167+
new KeyMapping.Category(ResourceLocation.fromNamespaceAndPath("inventorynetwork", "keys"))
168+
);
169+
KeyBindingHelper.registerKeyBinding(ultralightInventoryKey);
170+
171+
// Register HUD render callback for Ultralight Inventory overlay
172+
HudRenderCallback.EVENT.register((guiGraphics, tickCounter) -> {
173+
UltralightInventoryOverlay.render(guiGraphics);
174+
});
175+
176+
// Register Ultralight render mode toggle keybind (B key)
177+
ultralightRenderModeKey = new KeyMapping(
178+
"key.inventorynetwork.ultralight_rendermode",
179+
InputConstants.Type.KEYSYM,
180+
GLFW.GLFW_KEY_B,
181+
new KeyMapping.Category(ResourceLocation.fromNamespaceAndPath("inventorynetwork", "keys"))
182+
);
183+
KeyBindingHelper.registerKeyBinding(ultralightRenderModeKey);
184+
131185
// Database removed - no shutdown hook needed
132186
}
133187

@@ -210,6 +264,23 @@ private boolean handleOverlayMouseScroll(Screen screen, double mouseX, double mo
210264
private void onClientTick(Minecraft client) {
211265
tickCounter++;
212266

267+
// Handle Hello World keybind
268+
while (helloWorldKey.consumeClick()) {
269+
HelloWorldOverlay.toggle();
270+
}
271+
272+
// Handle Ultralight Inventory keybind
273+
while (ultralightInventoryKey.consumeClick()) {
274+
UltralightInventoryOverlay.toggle();
275+
}
276+
277+
// Handle Ultralight render mode toggle keybind (only when overlay is visible)
278+
while (ultralightRenderModeKey.consumeClick()) {
279+
if (UltralightInventoryOverlay.isVisible()) {
280+
UltralightInventoryOverlay.toggleRenderMode();
281+
}
282+
}
283+
213284
// Check if chest was closed (screen changed from chest to non-chest)
214285
boolean isChestOpen = false;
215286
Screen currentScreen = client.screen;

0 commit comments

Comments
 (0)