9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-23 17:09:29 +00:00
Files
Leaf/patches/server/0035-Fix-tracker-NPE.patch
Dreeam e703cd5445 Update 1.20.6 (#49)
* Update Leaf API patches to 1.20.5

* Updated Upstream (Purpur API)

* Some server patches work

* Update 1.20.6

* Some server patches work

* Some some server patches work

* 0oO0oO0oOo

* iI1IiI1i|!il|

* Updated Upstream (Gale/Purpur)

* Server patches work

* Updated Upstream (Gale)
2024-05-01 12:08:20 -04:00

46 lines
3.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Wed, 2 Aug 2023 16:14:12 +0800
Subject: [PATCH] Fix tracker NPE
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index da9b182bb8d7d4457a66ecbc2adb289956780693..3852985ebf9643f6b1b17a3d090175800bcdd079 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -244,7 +244,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final io.papermc.paper.util.player.NearbyPlayers nearbyPlayers;
// Paper end
// Paper start - optimise chunk tick iteration
- public final it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<ChunkHolder> needsChangeBroadcasting = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>();
+ public final Set<ChunkHolder> needsChangeBroadcasting = Sets.newConcurrentHashSet(); // Leaf - Fix tracker NPE
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap = new gg.pufferfish.pufferfish.util.AsyncPlayerAreaMap(this.pooledLinkedPlayerHashSets); // Pufferfish
// Paper end - optimise chunk tick iteration
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index e769e8d8e853b2731d85b75d273b029fd08861fa..6e19dc2d167e47ead14aba57bb2ae2fa5eb2282a 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -640,7 +640,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper - optimise chunk tick iteration
// Paper start - optimise chunk tick iteration
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
- it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
+ List<ChunkHolder> copy = new java.util.ArrayList<>(this.chunkMap.needsChangeBroadcasting); // Leaf - Fix tracker NPE
this.chunkMap.needsChangeBroadcasting.clear();
for (ChunkHolder holder : copy) {
holder.broadcastChanges(holder.getFullChunkNowUnchecked()); // LevelChunks are NEVER unloaded
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
index 894082d9a8e2aa05f86948bfd335090f37a4ba07..679f3295d3e6cf6fa8ff535d60b39ad5fa771b5d 100644
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
@@ -20,7 +20,7 @@ import org.slf4j.Logger;
public class AttributeMap {
private static final Logger LOGGER = LogUtils.getLogger();
private final Map<Holder<Attribute>, AttributeInstance> attributes = new Object2ObjectOpenHashMap<>();
- private final Set<AttributeInstance> dirtyAttributes = new ObjectOpenHashSet<>();
+ private final Set<AttributeInstance> dirtyAttributes = com.google.common.collect.Sets.newConcurrentHashSet(); // Leaf - Fix tracker NPE
private final AttributeSupplier supplier;
private final java.util.function.Function<Holder<Attribute>, AttributeInstance> createInstance; // Gale - Airplane - reduce entity allocations
private final net.minecraft.world.entity.LivingEntity entity; // Purpur