From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Taiyou06 Date: Fri, 9 May 2025 23:50:55 +0200 Subject: [PATCH] Only tick items at hand diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java index 59a61ac969e79966484a839b7d9ca0ac50e80994..82ac99c3c5b374482f3ff18f5d20bf888091e539 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java @@ -834,12 +834,19 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc super.tick(); } + // Leaf start - Only tick items at hand + if (org.dreeam.leaf.config.modules.opt.OptimizeItemTicking.onlyTickItemsInHand) { + this.synchronizeSpecialItemUpdates(this.getMainHandItem()); + this.synchronizeSpecialItemUpdates(this.getOffhandItem()); + } else { for (int i = 0; i < this.getInventory().getContainerSize(); i++) { ItemStack item = this.getInventory().getItem(i); if (!item.isEmpty()) { this.synchronizeSpecialItemUpdates(item); } } + } + // Leaf end - Only tick items at hand if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java index d1b7fffc20ccd00bcc82f830a1f53a85fd86658a..688a63644a66c0cd3f08deb3786d756c310c079c 100644 --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java @@ -639,7 +639,14 @@ public abstract class Player extends LivingEntity { } this.tickRegeneration(); + // Leaf start - Only tick items at hand + if (org.dreeam.leaf.config.modules.opt.OptimizeItemTicking.onlyTickItemsInHand) { + this.getMainHandItem().inventoryTick(this.level(), this, EquipmentSlot.MAINHAND); + this.getOffhandItem().inventoryTick(this.level(), this, EquipmentSlot.OFFHAND); + } else { this.inventory.tick(); + } + // Leaf end - Only tick items at hand this.oBob = this.bob; if (this.abilities.flying && !this.isPassenger()) { this.resetFallDistance();