From 9919e5c1d56e3faf37d1038995f203ca453ba9fa Mon Sep 17 00:00:00 2001 From: sciwhiz12 Date: Sat, 31 Dec 2022 02:56:34 +0800 Subject: [PATCH] Fix mob block breaking AI when chunk 0,0 is unloaded Fixes #9241 (#9250) --- .../world/entity/ai/goal/RemoveBlockGoal.java.patch | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch index 079a07d8bb..da02095763 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch @@ -5,7 +5,18 @@ public boolean m_8036_() { - if (!this.f_25837_.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ if (!net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.f_25837_.f_19853_, this.f_25602_, this.f_25837_)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_25837_.f_19853_, this.f_25837_)) { return false; } else if (this.f_25600_ > 0) { --this.f_25600_; +@@ -133,7 +_,9 @@ + if (chunkaccess == null) { + return false; + } else { +- return chunkaccess.m_8055_(p_25851_).m_60713_(this.f_25836_) && chunkaccess.m_8055_(p_25851_.m_7494_()).m_60795_() && chunkaccess.m_8055_(p_25851_.m_6630_(2)).m_60795_(); ++ net.minecraft.world.level.block.state.BlockState state = chunkaccess.m_8055_(p_25851_); ++ if (!(state.canEntityDestroy(p_25850_, p_25851_, this.f_25837_) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this.f_25837_, p_25851_, state))) return false; ++ return state.m_60713_(this.f_25836_) && chunkaccess.m_8055_(p_25851_.m_7494_()).m_60795_() && chunkaccess.m_8055_(p_25851_.m_6630_(2)).m_60795_(); + } + } + }