AllenSeitz / DimDungeons

A Minecraft mod which adds proceedurally generated dungeons.
14 stars 11 forks source link

Crash in a debug world due to TileEntityPortalKeyhole expecting an `ItemPortalKey` but getting an `AirItem` due to debug world #77

Open ChiefArug opened 1 month ago

ChiefArug commented 1 month ago

To create a debug world go to the world tab and hold Alt then click to cycle through the world types until it says Debug. Version 1.20.1.

Important part of log:

[00:02:39] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.ReportedException: Ticking block entity
    at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:897) ~[client-1.20.1-20230612.114412-srg.jar%23752!/:?]
    at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:814) ~[client-1.20.1-20230612.114412-srg.jar%23752!/:?]
    at net.minecraft.client.server.IntegratedServer.m_5705_(IntegratedServer.java:89) ~[client-1.20.1-20230612.114412-srg.jar%23752!/:?]
    at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661) ~[client-1.20.1-20230612.114412-srg.jar%23752!/:?]
    at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[client-1.20.1-20230612.114412-srg.jar%23752!/:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ClassCastException: class net.minecraft.world.item.AirItem cannot be cast to class com.catastrophe573.dimdungeons.item.ItemPortalKey (net.minecraft.world.item.AirItem is in module minecraft@1.20.1 of loader 'TRANSFORMER' @3bcc8f13; com.catastrophe573.dimdungeons.item.ItemPortalKey is in module dimdungeons@191 of loader 'TRANSFORMER' @3bcc8f13)
    at com.catastrophe573.dimdungeons.block.TileEntityPortalKeyhole.tick(TileEntityPortalKeyhole.java:38) ~[dimdungeons-191-forge-1.20.1.jar%23536!/:191]
    at net.minecraft.world.level.chunk.LevelChunk$BoundTickingBlockEntity.m_142224_(LevelChunk.java:689) ~[client-1.20.1-20230612.114412-srg.jar%23752!/:?]
    at net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper.m_142224_(LevelChunk.java:782) ~[client-1.20.1-20230612.114412-srg.jar%23752!/:?]
    at net.minecraft.world.level.Level.m_46463_(Level.java:468) ~[client-1.20.1-20230612.114412-srg.jar%23752!/:?]
    at net.minecraft.server.level.ServerLevel.m_8793_(ServerLevel.java:351) ~[client-1.20.1-20230612.114412-srg.jar%23752!/:?]
    at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:893) ~[client-1.20.1-20230612.114412-srg.jar%23752!/:?]
    ... 5 more

Block information from crash report:

Details:
    Name: dimdungeons:tileentity_portal_keyhole // com.catastrophe573.dimdungeons.block.TileEntityPortalKeyhole
    Block: Block{dimdungeons:block_portal_keyhole}[facing=east,filled=false,is_building=true,lit=true]
    Block location: World: (603,70,1265), Section: (at 11,6,1 in 37,4,79; chunk contains blocks 592,-64,1264 to 607,319,1279), Region: (1,2; contains chunks 32,64 to 63,95, blocks 512,-64,1024 to 1023,319,1535)
    Block: Block{dimdungeons:block_portal_keyhole}[facing=east,filled=false,is_building=true,lit=true]
    Block location: World: (603,70,1265), Section: (at 11,6,1 in 37,4,79; chunk contains blocks 592,-64,1264 to 607,319,1279), Region: (1,2; contains chunks 32,64 to 63,95, blocks 512,-64,1024 to 1023,319,1535)

The debug world consists of all blockstates in game and is very useful for testing things that could break, providing easy access to placed versions of every block. However it does have some weirdness, which is causing issues here due to DimDungeons assuming that the inserted object exists even though it doesn't. The issue could probably be replicated using the debug stick to forcefully change the state, or using a command like /setblock. Full log & crash report: https://gist.github.com/ChiefArug/8dfa6a0bf0008a905c49fb95fd046b37

AllenSeitz commented 1 month ago

Thank you! I will fix this in the next version, which should be releasing soon.