Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsjo committed Nov 14, 2024
1 parent 4cb1fbd commit 0bce53b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/render/ItemModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ export namespace ItemModel {
const property = Json.readString(root.property)?.replace(/^minecraft:/, '')

switch (property){
case 'using_item':
case 'fishing_rod/cast':
case 'selected':
case 'carried':
case 'extended_view':
return (item, context) => context[property] ?? false
case 'using_item':
return (item, context) => (context.use_duration ?? -1) >= 0
case 'bundle/has_selected_item':
return (item, context) => (context['bundle/selected_item'] ?? -1) >= 0
case 'broken': return (item, context) => {
Expand Down Expand Up @@ -346,7 +347,13 @@ export namespace ItemModel {
return ItemStack.fromNbt(selectedItemTag)
})

return selectedItem !== undefined ? ItemRenderer.getItemMesh(selectedItem, resources, {...context, 'bundle/selected_item': undefined}) : new Mesh()
return selectedItem !== undefined ? ItemRenderer.getItemMesh(selectedItem, resources, {
...context,
'bundle/selected_item': -1,
selected: false,
carried: false,
use_duration: -1
}) : new Mesh()
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/render/ItemRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export interface ItemRendererResources extends BlockModelProvider, TextureAtlasP
export type ItemRenderingContext = {
display_context?: Display,

using_item?: boolean,
'fishing_rod/cast'?: boolean,
'bundle/selected_item'?: number,
selected?: boolean,
Expand Down

0 comments on commit 0bce53b

Please sign in to comment.