mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-04 15:41:40 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@b0da38c2 Repository details in RuntimeException for MavenLibraryResolver#addRepository (#12939) PaperMC/Paper@1922be90 Update custom tags (#12183) PaperMC/Paper@79cf1353 Ignore HopperInventorySearchEvent when it has no listeners (#13009) PaperMC/Paper@ea014f7a feat: add stuckEntityPoiRetryDelay config (#12949) PaperMC/Paper@a9e76749 Support for showNotification in PlayerRecipeDiscoverEvent (#12992) PaperMC/Paper@5622c9dd Expose attribute sentiment (#12974) PaperMC/Paper@42b653b1 Expose more argument types (#12665) PaperMC/Paper@52d9a221 [ci/skip] Fix typo in Display javadoc (#13010) PaperMC/Paper@614e9acf Improve APIs around riptide tridents (#12996) PaperMC/Paper@51706e5a Fixed DyeItem sheep dye hunk
42 lines
2.8 KiB
Diff
42 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
|
Date: Tue, 17 Sep 2024 02:35:13 -0400
|
|
Subject: [PATCH] Replace Entity active effects map with optimized collection
|
|
|
|
Dreeam TODO: check this
|
|
|
|
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
|
index 2d8562ab5f399d5be8453bca0637586f7e221c8a..6214467ae7e2e9d84e46abed00a94bc22d4a3da7 100644
|
|
--- a/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -208,6 +208,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
private static final Dynamic<?> EMPTY_BRAIN = new Dynamic<>(JavaOps.INSTANCE, Map.of("memories", Map.of()));
|
|
private final AttributeMap attributes;
|
|
public CombatTracker combatTracker = new CombatTracker(this);
|
|
+ // Need to figure out the difference of mem access pattern between hash map and obj2obj hash map (separate chaining vs open addressing)
|
|
+ // Benchmark is needed for get calls for this active effects map.
|
|
+ // Also need to check whether call from out of main using bukkit api
|
|
+ //public final Map<Holder<MobEffect>, MobEffectInstance> activeEffects = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(0); // Leaf - Replace Entity active effects map with optimized collection
|
|
public final Map<Holder<MobEffect>, MobEffectInstance> activeEffects = Maps.newHashMap();
|
|
private final Map<EquipmentSlot, ItemStack> lastEquipmentItems = Util.makeEnumMap(EquipmentSlot.class, slot -> ItemStack.EMPTY);
|
|
public boolean swinging;
|
|
@@ -1015,15 +1019,16 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
private void updateSynchronizedMobEffectParticles() {
|
|
// Leaf start - Remove stream in entity visible effects filter
|
|
List<ParticleOptions> list = new java.util.ArrayList<>();
|
|
+ final Collection<MobEffectInstance> effectsValues = this.activeEffects.values(); // Leaf - Replace Entity active effects map with optimized collection
|
|
|
|
- for (MobEffectInstance effect : this.activeEffects.values()) {
|
|
+ for (MobEffectInstance effect : effectsValues) { // Leaf - Replace Entity active effects map with optimized collection
|
|
if (effect.isVisible()) {
|
|
list.add(effect.getParticleOptions());
|
|
}
|
|
}
|
|
// Leaf end - Remove stream in entity visible effects filter
|
|
this.entityData.set(DATA_EFFECT_PARTICLES, list);
|
|
- this.entityData.set(DATA_EFFECT_AMBIENCE_ID, areAllEffectsAmbient(this.activeEffects.values()));
|
|
+ this.entityData.set(DATA_EFFECT_AMBIENCE_ID, areAllEffectsAmbient(effectsValues)); // Leaf - Replace Entity active effects map with optimized collection
|
|
}
|
|
|
|
private void updateGlowingStatus() {
|