From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: mrhua269 Date: Fri, 28 Nov 2025 21:41:51 +0800 Subject: [PATCH] Prevent tamable animals check can teleport in an unloaded chunk Based on the implementation of Canvas(https://github.com/CraftCanvasMC/Canvas/commit/af2aacb12cbccfd328dda4961167786f5d9dad53) We need to check canTeleport for TamableAnimal but this logic could do the check in another tick region itself, so we need to prevent that. But it needs to push off this check to schedule to the correct tickregion, which needs costly rewriting of this logic, so we could simply allow the read when the owner's position is loaded diff --git a/net/minecraft/world/entity/TamableAnimal.java b/net/minecraft/world/entity/TamableAnimal.java index ff628c93d1cc3367272208efcb6b20b4a9999478..49b1af960534be93647cbde6341f9deb1b2dfab4 100644 --- a/net/minecraft/world/entity/TamableAnimal.java +++ b/net/minecraft/world/entity/TamableAnimal.java @@ -308,7 +308,8 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { if (pathTypeStatic != PathType.WALKABLE) { return false; } else { - BlockState blockState = this.level().getBlockState(pos.below()); + BlockState blockState = this.level().getBlockStateIfLoaded(pos.below()); // Luminol - Prevent tamable animals check can teleport in an unloaded chunk + if (blockState == null) return false; // Luminol - Prevent tamable animals check can teleport in an unloaded chunk if (!this.canFlyToOwner() && blockState.getBlock() instanceof LeavesBlock) { return false; } else {