mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-31 04:46:38 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@9f004614 Update a whole lot of deprecated annotations PaperMC/Paper@72f13f8b [ci/skip] Mention API Checks for CONTRIBUTING.md (#12315) PaperMC/Paper@7cc6cb50 Check for trailing input in ItemFactory#createItemStack (#12312) PaperMC/Paper@f49d18df Add get/set customName to Skull block (#12302) PaperMC/Paper@894631f0 Make advancement ordering predictable (#12292) PaperMC/Paper@2aad131e Add config option for command spam whitelist PaperMC/Paper@bb3b7e69 Fix annotation mistakes PaperMC/Paper@058455e4 InventoryView QOL open method (#12282) PaperMC/Paper@f2258582 Fix firework entity not being removed when FireworkExplodeEvent is cancelled (#12268) PaperMC/Paper@7819df10 Add getHeight method to ChunkData (#12311) PaperMC/Paper@37b9ca1f Add flush parameter to World#save (#12330) PaperMC/Paper@515e12ca Check if BUNDLE_CONTENTS is present in InventoryClickEvent (#12321) PaperMC/Paper@5a6ab97b Add config to remove player as vehicle restriction in /ride (#12327) PaperMC/Paper@c467df95 Add ItemStack#copyDataFrom (#12224) Gale Changes: Dreeam-qwq/Gale@d5143ee0 Updated Upstream (Paper) Dreeam-qwq/Gale@63c396e7 Updated Upstream (Paper) Dreeam-qwq/Gale@5c2147b4 Updated Upstream (Paper) Dreeam-qwq/Gale@804ecea0 Rebuild patches
25 lines
1.3 KiB
Diff
25 lines
1.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Taiyou06 <kaandindar21@gmail.com>
|
|
Date: Sat, 22 Mar 2025 00:07:38 +0100
|
|
Subject: [PATCH] Optimize addOrUpdateTransientModifier
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/ai/attributes/AttributeInstance.java b/net/minecraft/world/entity/ai/attributes/AttributeInstance.java
|
|
index ceff383d565267edd13a6d9006030b8e1f8053e3..71fb9a61e8d3ac7094d0630aebdc46dbe74dd0ae 100644
|
|
--- a/net/minecraft/world/entity/ai/attributes/AttributeInstance.java
|
|
+++ b/net/minecraft/world/entity/ai/attributes/AttributeInstance.java
|
|
@@ -88,8 +88,11 @@ public class AttributeInstance {
|
|
}
|
|
|
|
public void addOrUpdateTransientModifier(AttributeModifier modifier) {
|
|
- AttributeModifier attributeModifier = this.modifierById.put(modifier.id(), modifier);
|
|
- if (modifier != attributeModifier) {
|
|
+ // First check if we already have the same modifier instance to avoid unnecessary put operations
|
|
+ AttributeModifier existingModifier = this.modifierById.get(modifier.id());
|
|
+ // Only perform updates if the modifier is new or different
|
|
+ if (existingModifier != modifier) {
|
|
+ this.modifierById.put(modifier.id(), modifier);
|
|
this.getModifiers(modifier.operation()).put(modifier.id(), modifier);
|
|
this.setDirty();
|
|
}
|