mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
Paper Changes: PaperMC/Paper@c2bb144f Properly save level data async (#12530) PaperMC/Paper@e2ca4773 Remove simplify remote item matching option for now
46 lines
2.3 KiB
Diff
46 lines
2.3 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 43c4b8e54842310e48bcdaa991c68ff9571d7249..943f48c41214f440517ecf7f392e08f0e4d1b888 100644
|
|
--- a/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -888,9 +888,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
|
super.tick();
|
|
}
|
|
|
|
- for (int i = 0; i < this.getInventory().getContainerSize(); i++) {
|
|
- ItemStack item = this.getInventory().getItem(i);
|
|
- if (!item.isEmpty()) {
|
|
+ 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()) continue;
|
|
this.synchronizeSpecialItemUpdates(item);
|
|
}
|
|
}
|
|
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
|
|
index 67c4cbb8ed6131b639b01e4fc0cbf56057a3fe03..8bab487a1d77d8227bf9426d0218e906db034982 100644
|
|
--- a/net/minecraft/world/entity/player/Player.java
|
|
+++ b/net/minecraft/world/entity/player/Player.java
|
|
@@ -631,7 +631,12 @@ public abstract class Player extends LivingEntity {
|
|
}
|
|
|
|
this.tickRegeneration();
|
|
- this.inventory.tick();
|
|
+ if (org.dreeam.leaf.config.modules.opt.OptimizeItemTicking.onlyTickItemsInHand) {
|
|
+ this.getMainHandItem().inventoryTick(this.level(), this, 0, true);
|
|
+ this.getOffhandItem().inventoryTick(this.level(), this, 0, true);
|
|
+ } else {
|
|
+ this.inventory.tick();
|
|
+ }
|
|
this.oBob = this.bob;
|
|
if (this.abilities.flying && !this.isPassenger()) {
|
|
this.resetFallDistance();
|