Skip to content

Commit 6fb18d4

Browse files
committed
fixes & workarounds rendering items in inventory (some were broken since last commit)
1 parent b9df1bc commit 6fb18d4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/inventoryWindows.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export const renderSlot = (model: ResolvedItemModelRender, debugIsQuickbar = fal
205205
if (!fullBlockModelSupport) {
206206
const atlas = activeGuiAtlas.atlas?.json
207207
// todo atlas holds all rendered blocks, not all possibly rendered item/block models, need to request this on demand instead (this is how vanilla works)
208-
const item = atlas?.textures[itemModelName.replace('minecraft:', '').replace('block/', '').replace('blocks/', '').replace('item/', '').replace('items/', '')]
208+
const item = atlas?.textures[itemModelName.replace('minecraft:', '').replace('block/', '').replace('blocks/', '').replace('item/', '').replace('items/', '').replace('_inventory', '').replace('_bottom', '')]
209209
if (item) {
210210
const x = item.u * atlas.width
211211
const y = item.v * atlas.height

src/resourcesManager.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ export const getItemModelName = (item: GeneralInputItem, specificProps: ItemSpec
1414
const itemSelector = playerState.getItemSelector({
1515
...specificProps
1616
})
17-
const model = getItemDefinition(viewer.world.itemsDefinitionsStore, {
17+
const modelFromDef = getItemDefinition(viewer.world.itemsDefinitionsStore, {
1818
name: itemModelName,
1919
version: viewer.world.texturesVersion!,
2020
properties: itemSelector
21-
})?.model ?? itemModelName
21+
})?.model
22+
const model = (modelFromDef === 'minecraft:special' ? undefined : modelFromDef) ?? itemModelName
2223
return model
2324
}

0 commit comments

Comments
 (0)