-
-
Notifications
You must be signed in to change notification settings - Fork 163
Update item stack on update, not every tick #1976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Update item stack on update, not every tick #1976
Conversation
| InventorySearch.refreshSlot(slot); | ||
| } | ||
| ItemPickupWidget.getInstance().onItemPickup(slot, stack); | ||
| ((ItemStackUpdateDurability) (Object) stack).skyblocker$getAndCacheDurability(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do need it to update every tick for #1961
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for ticking cooldowns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
May have conflicts with #1961