minecraft-inventory 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -195,7 +195,9 @@ export const ItemCanvas = memo(function ItemCanvas({
|
|
|
195
195
|
|
|
196
196
|
{/* Durability bar — vanilla layout: x=2, y=13 in 16×16 item area */}
|
|
197
197
|
{hasDurability && (() => {
|
|
198
|
-
|
|
198
|
+
// Derive mcPx from renderSize so the bar always fits the container,
|
|
199
|
+
// even at fractional scales where contentSize ≠ 16 * round(scale).
|
|
200
|
+
const mcPx = Math.max(1, Math.floor(renderSize / 16))
|
|
199
201
|
const barLeft = 2 * mcPx
|
|
200
202
|
const bgBottom = mcPx
|
|
201
203
|
const bgWidth = 13 * mcPx
|
|
@@ -229,16 +229,13 @@ export function Slot({
|
|
|
229
229
|
const handleWheel = useCallback(
|
|
230
230
|
(e: WheelEvent) => {
|
|
231
231
|
if (isMobile || disabled) return
|
|
232
|
+
if (onClickOverride) return // JEI slots: let parent handle wheel for pagination
|
|
232
233
|
if (!item && !heldItem) return
|
|
233
234
|
e.preventDefault()
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
} else {
|
|
237
|
-
|
|
238
|
-
sendAction({ type: 'click', slotIndex: index, button: 'right', mode: 'normal' })
|
|
239
|
-
} else if (e.deltaY > 0 && heldItem) {
|
|
240
|
-
sendAction({ type: 'click', slotIndex: index, button: 'right', mode: 'normal' })
|
|
241
|
-
}
|
|
235
|
+
if (e.deltaY < 0 && item) {
|
|
236
|
+
sendAction({ type: 'click', slotIndex: index, button: 'right', mode: 'normal' })
|
|
237
|
+
} else if (e.deltaY > 0 && heldItem) {
|
|
238
|
+
sendAction({ type: 'click', slotIndex: index, button: 'right', mode: 'normal' })
|
|
242
239
|
}
|
|
243
240
|
},
|
|
244
241
|
[isMobile, disabled, item, heldItem, sendAction, index, onClickOverride],
|
|
@@ -62,15 +62,15 @@ function gridSlots(
|
|
|
62
62
|
return slots
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
// Slot positions within gui/widgets hotbar texture — matches
|
|
66
|
-
//
|
|
65
|
+
// Slot positions within gui/widgets hotbar texture — matches vanilla Gui.java:
|
|
66
|
+
// item area at x: 3, y: 3, 20px per slot (16 item + 4 border/separator)
|
|
67
67
|
const HUD_SLOT_STEP = 20
|
|
68
68
|
function hudHotbarSlots(): RawSlot[] {
|
|
69
69
|
return Array.from({ length: 9 }, (_, col) => ({
|
|
70
70
|
// First slot carries explicit index: 36 so the running counter starts there
|
|
71
71
|
...(col === 0 ? { index: 36 } : {}),
|
|
72
|
-
x: 3
|
|
73
|
-
y: 3
|
|
72
|
+
x: 3 + col * HUD_SLOT_STEP,
|
|
73
|
+
y: 3,
|
|
74
74
|
group: 'hotbar',
|
|
75
75
|
}))
|
|
76
76
|
}
|