The Vanilla Experience (Mod) (Forge)

The Vanilla Experience (Mod) (Forge)

118k Downloads

[Double Doors] Crash when villagers attempt to remember a door that is in an invalid state

Closed this issue ยท 3 comments

commented

Information

Minecraft version: 1.20.1
Modloader: Fabric
Fabric loader version: 0.16.14
Environment: Multiplayer

Mod name: Mod
Mod version: 7.0

Description

When a villager enters simulation distance and attempts to remember a door that is in an invalid state, the game can crash.

Image

Crash report

crash-2025-05-10_14.53.58-server.txt

Suggested fix

diff --git a/Common/src/main/java/com/natamus/doubledoors/mixin/InteractWithDoorMixin.java b/Common/src/main/java/com/natamus/doubledoors/mixin/InteractWithDoorMixin.java
index 6c5111d..0e3e279 100644
--- a/Common/src/main/java/com/natamus/doubledoors/mixin/InteractWithDoorMixin.java
+++ b/Common/src/main/java/com/natamus/doubledoors/mixin/InteractWithDoorMixin.java
@@ -33,6 +33,10 @@ public class InteractWithDoorMixin {
 
     @Inject(method = "rememberDoorToClose(Lnet/minecraft/world/entity/ai/behavior/declarative/MemoryAccessor;Ljava/util/Optional;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;)Ljava/util/Optional;", at = @At(value = "HEAD"))
     private static void rememberDoorToClose(MemoryAccessor<OptionalBox.Mu, Set<GlobalPos>> $$0, Optional<Set<GlobalPos>> $$1, ServerLevel serverLevel, BlockPos blockPos, CallbackInfoReturnable<Optional<Set<GlobalPos>>> cir) {
-        Util.processDoor(null, serverLevel, blockPos, serverLevel.getBlockState(blockPos), null);
+        var blockState = serverLevel.getBlockState(blockPos);
+        if (!Util.isDoorBlock(blockState)) {
+            return;
+        }
+        Util.processDoor(null, serverLevel, blockPos, blockState, null);
     }
 }
commented

I would assume Minecraft kind of "normalises" door position and in this case it results in door being at where some other mod overrode it with cobble upon world generation. Hence why it probably never occurred in tests, because it's so specific lol. Also, mod loader was definitely Fabric, not Forge :p

commented

On fabric 1.20.1, had a ticking entity error where a villager targeted an invalid block, mossy cobblestone, as a double door and crashes the server.
2025-05-13-3.log

commented

Thank you for opening the issue. Version 7.1 of Double Doors fixes the problem. Apologies for the inconvenience.

https://curseforge.com/minecraft/mc-mods/double-doors/files