Scrap !!
This commit is contained in:
@@ -127,8 +127,17 @@ export function render_item_entity(entity: ItemEntity, partial_tick: number) {
|
||||
}
|
||||
}
|
||||
|
||||
// the stacks shown items are drawn as, by their "item" client data, which is replaced whenever it changes
|
||||
const shown_stacks = new WeakMap<ItemData, ItemStack>();
|
||||
// the stack an item synced to clients is drawn as, like a shown item's "item" client data or an object's. made once
|
||||
// for each, since the data is replaced whenever it changes
|
||||
export function synced_stack(data: ItemData): ItemStack {
|
||||
let stack = synced_stacks.get(data);
|
||||
if (!stack) {
|
||||
stack = ItemStack.from_data(data);
|
||||
synced_stacks.set(data, stack);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
const synced_stacks = new WeakMap<ItemData, ItemStack>();
|
||||
|
||||
// every item blocks with item_display show on top of them, their "item" client data, see BlockRegistry.item_display.
|
||||
// the atlas has to be the current texture
|
||||
@@ -143,11 +152,7 @@ export function render_block_items(level: ClientLevel) {
|
||||
const value = level.get_block_value(x, y, z);
|
||||
const block = blocks[value & ID_MASK];
|
||||
if (!block?.item_display) continue;
|
||||
let item = shown_stacks.get(shown);
|
||||
if (!item) {
|
||||
item = ItemStack.from_data(shown);
|
||||
shown_stacks.set(shown, item);
|
||||
}
|
||||
const item = synced_stack(shown);
|
||||
// the block's own light, or the one above for blocks light doesn't get into, since the items sit on top
|
||||
const here = level.get_light(x, y, z);
|
||||
const above = level.get_light(x, y + 1, z);
|
||||
|
||||
Reference in New Issue
Block a user