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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecraft-inventory",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "release": {
@@ -298,7 +298,7 @@ export function InventoryOverlay({
298
298
  lineHeight: 1,
299
299
  }}
300
300
  >
301
- INV 0.1.12
301
+ INV 0.1.13
302
302
  </a>
303
303
  )}
304
304
 
@@ -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
- <div className="mc-inv-item-durability-bg" style={{
200
- position: 'absolute',
201
- bottom: 1,
202
- left: 1,
203
- width: 'calc(100% - 2px)',
204
- height: Math.max(1, Math.round(renderSize * 0.063)),
205
- background: '#000',
206
- pointerEvents: 'none',
207
- }} />
208
- <div className="mc-inv-item-durability-bar" style={{
209
- position: 'absolute',
210
- bottom: 1,
211
- left: 1,
212
- width: `${(item.durability! / item.maxDurability!) * 100}%`,
213
- height: Math.max(1, Math.round(renderSize * 0.063)),
214
- background: barColor,
215
- pointerEvents: 'none',
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 && (