Update item stack on update, not every tick#1976
Update item stack on update, not every tick#1976InspectorBoat wants to merge 4 commits intoSkyblockerMod:masterfrom
Conversation
| InventorySearch.refreshSlot(slot); | ||
| } | ||
| ItemPickupWidget.getInstance().onItemPickup(slot, stack); | ||
| ((ItemStackUpdateDurability) (Object) stack).skyblocker$getAndCacheDurability(); |
There was a problem hiding this comment.
Don’t you need this to be called on component update as well? We already have a mixin for that somewhere as well.
There was a problem hiding this comment.
Are you referring to the code for cancelComponentUpdateAnimation? That occurs in renderer code: ItemInHandRendererMixin.
There is also DataComponentHolderMixin, but that method doesn't seem to have a relevant update function.
Also, I don't believe the server even has a way to partially update an inventory stack's components: the only relevant packet seems to be ClientboundContainerSetSlotPacket, which always goes through setItem.
There was a problem hiding this comment.
(I also did verify that the durability bar correctly updates while mining.)
|
Okay, it turns out the major source of lag was not from updating every item in the inventory every tick, but rather updating on ItemStack creation: in some areas (like the hub, or a private island) thousands of items are created per tick: |
| * Updates the durability of this item stack every tick when in the inventory. | ||
| */ | ||
| @Inject(method = "inventoryTick", at = @At("TAIL")) | ||
| private void skyblocker$updateDamage(CallbackInfo ci) { |
There was a problem hiding this comment.
for ticking cooldowns?
May have conflicts with #1961