Fix mob block breaking AI when chunk 0,0 is unloaded Fixes #9241 (#9250)

This commit is contained in:
sciwhiz12 authored and GitHub committed 2022-12-30 10:56:34 -08:00
1 parent 84a8997263
commit 9919e5c1d5
1 file changed
+12 -1
@@ -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_();
}
}
}