Fix onChunkUnloaded not gettting called correctly (#8103)

This commit is contained in:
ichttt authored and GitHub committed 2021-11-24 13:53:51 -08:00
1 parent 5f87bde00e
commit 20e309c339
2 files changed
+7 -12

No files matched your search

@@ -9,14 +9,6 @@
protected static final Logger f_46426_ = LogManager.getLogger();
public static final Codec<ResourceKey<Level>> f_46427_ = ResourceLocation.f_135803_.xmap(ResourceKey.m_135797_(Registry.f_122819_), ResourceKey::m_135782_);
public static final ResourceKey<Level> f_46428_ = ResourceKey.m_135785_(Registry.f_122819_, new ResourceLocation("overworld"));
@@ -82,6 +_,7 @@
protected final List<TickingBlockEntity> f_151512_ = Lists.newArrayList();
private final List<TickingBlockEntity> f_151503_ = Lists.newArrayList();
private boolean f_151504_;
+ protected final java.util.Set<BlockEntity> f_46434_ = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); // Forge: faster "contains" makes removal much more efficient
private final Thread f_46423_;
private final boolean f_46424_;
private int f_46425_;
@@ -99,8 +_,14 @@
private final WorldBorder f_46447_;
private final BiomeManager f_46420_;
@@ -121,7 +113,7 @@
}
});
CrashReportCategory.m_178950_(crashreportcategory, this, p_46587_, blockstate);
@@ -401,11 +_,28 @@
@@ -401,10 +_,26 @@
(this.f_151504_ ? this.f_151503_ : this.f_151512_).add(p_151526_);
}
@@ -146,10 +138,8 @@
+ this.freshBlockEntities.clear();
+ }
if (!this.f_151503_.isEmpty()) {
+ this.f_46434_.forEach(e -> e.onChunkUnloaded());
this.f_151512_.addAll(this.f_151503_);
this.f_151503_.clear();
}
@@ -427,12 +_,15 @@
public <T extends Entity> void m_46653_(Consumer<T> p_46654_, T p_46655_) {
@@ -95,7 +95,12 @@
});
}
@@ -763,6 +_,7 @@
@@ -759,10 +_,12 @@
}
public void m_156368_() {
+ this.f_62779_.values().forEach(BlockEntity::onChunkUnloaded);
this.f_62779_.values().forEach(this::m_156400_);
}
public void m_156369_() {