From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrHua269 Date: Wed, 29 Jan 2025 14:57:20 +0800 Subject: [PATCH] Skip collision check if the block is not belong to current tick region A temporary fix of these issues: https://github.com/PaperMC/Folia/issues/311 Due to that mojang won't ignore the blocks the entity passed by, and sometimes the old position may not be updated and it points to a block that we don't own it, and it will access it during applyEffectsFromBlocks.So the best way to fix that is to skip the collision check of that block because it was already not owned by us and it's not necessary to check it Related to mojang's bug fix: https://bugs.mojang.com/browse/MC-92875 diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java index aa4337942b4b9b7dd746b9b9c5a052d626b1e72c..61814607a6c8e4ce8d07645f005ea8d53f624c95 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -1675,6 +1675,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return; } + // Luminol start - Try fixing folia's old position issue + if(!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level, blockPos) && me.earthme.luminol.config.modules.fixes.FoliaOldPositionIssueFixConfig.enabled) { + continue; + } + // Luminol end + BlockState blockState = this.level().getBlockState(blockPos); if (!blockState.isAir() && set.add(blockPos.asLong())) { try {