mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-30 20:39:21 +00:00
* rebase * optimize LivingEntity#travel * cleanup * Replace fluid height map * reuse array list in Entity#collide * cleanup * fix fire and liquid collision shape * fix checkInside * inline betweenClosed * cleanup * optimize getOnPos * optimize equals in getOnPos * update mainSupportingBlockPos on dirty * cleanup * rename * merge same patch * rebase and remove properly * [ci skip] cleanup * rebase and rebuild * fix async locator * remove async locator * cleanup * rebase --------- Co-authored-by: Taiyou06 <kaandindar21@gmail.com>
50 lines
2.4 KiB
Diff
50 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Taiyou06 <kaandindar21@gmail.com>
|
|
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 29f250f78bdd3c523b859d09d5561db088c6e72b..648f80a2cbe41dd645c56c96821567aa3ae53c5d 100644
|
|
--- a/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -848,12 +848,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 7c87ae05c4932fb53ce395257994bcef031337b7..2da9d6a2c12f490bda2cd0b9fb83fa35749f8761 100644
|
|
--- a/net/minecraft/world/entity/player/Player.java
|
|
+++ b/net/minecraft/world/entity/player/Player.java
|
|
@@ -648,7 +648,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();
|