minecraft-inventory 0.1.12 → 0.1.13
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
|
@@ -193,29 +193,40 @@ export const ItemCanvas = memo(function ItemCanvas({
|
|
|
193
193
|
/>
|
|
194
194
|
) : null /* still loading — render nothing (slot stays empty) */}
|
|
195
195
|
|
|
196
|
-
{/* Durability bar */}
|
|
197
|
-
{hasDurability && (
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
196
|
+
{/* Durability bar — vanilla layout: x=2, y=13 in 16×16 item area */}
|
|
197
|
+
{hasDurability && (() => {
|
|
198
|
+
const mcPx = Math.max(1, Math.round(pixelSize))
|
|
199
|
+
const barLeft = 2 * mcPx
|
|
200
|
+
const bgBottom = mcPx
|
|
201
|
+
const bgWidth = 13 * mcPx
|
|
202
|
+
const bgHeight = 2 * mcPx
|
|
203
|
+
const ratio = item.durability! / item.maxDurability!
|
|
204
|
+
const fillWidth = Math.round(13 * ratio) * mcPx
|
|
205
|
+
const fillHeight = mcPx
|
|
206
|
+
const fillBottom = 2 * mcPx
|
|
207
|
+
return (
|
|
208
|
+
<>
|
|
209
|
+
<div className="mc-inv-item-durability-bg" style={{
|
|
210
|
+
position: 'absolute',
|
|
211
|
+
bottom: bgBottom,
|
|
212
|
+
left: barLeft,
|
|
213
|
+
width: bgWidth,
|
|
214
|
+
height: bgHeight,
|
|
215
|
+
background: '#000',
|
|
216
|
+
pointerEvents: 'none',
|
|
217
|
+
}} />
|
|
218
|
+
<div className="mc-inv-item-durability-bar" style={{
|
|
219
|
+
position: 'absolute',
|
|
220
|
+
bottom: fillBottom,
|
|
221
|
+
left: barLeft,
|
|
222
|
+
width: fillWidth,
|
|
223
|
+
height: fillHeight,
|
|
224
|
+
background: barColor,
|
|
225
|
+
pointerEvents: 'none',
|
|
226
|
+
}} />
|
|
227
|
+
</>
|
|
228
|
+
)
|
|
229
|
+
})()}
|
|
219
230
|
|
|
220
231
|
{/* Item count */}
|
|
221
232
|
{!noCount && item.count > 1 && (
|