[crash]
winsrp opened this issue ยท 18 comments
Minecolonies version
minecolonies-universal-1.12.2-0.8.4523.jar
Expected behavior
uh... load...
Actual behaviour
crash on loading map...
Steps to reproduce the problem
- no idea.... it crashed when i was smelting wood into charcoal, and now it no longer loads, but based on the crash report it has something to do with your mod, so here it goes.
Report
yo @Raycoms
Seems you're trying to cast a buildingTownHall to a buildingHome
https://github.com/Minecolonies/minecolonies/blob/bb18de717beb6d60242a5f27738542ee8341ccbf/src/main/java/com/minecolonies/coremod/entity/ai/minimal/EntityAIGoHome.java#L88
I think you've accidentally ignored when a citizen doesn't have a home (I.E. their home is the townHall)
Hey @winsrp can you make a backup of your world and try load it with the version of 1.12.2 just before V4523 (The bug was only added 6hrs ago)
(We'll fix the bug, i'm just not sure how ray would want it fixed, so i'll leave it for now)
don't you have like a... if citizenhashome then... use townhall, else use home? kind of thing, (vb.net programmer here XD)
Here, so the problem line is this:
return (isCitizenHungry() && !((BuildingHome) homeBuilding).isFoodNeeded()) || !(homeBuilding instanceof BuildingHome);
basically he's trying to Convert the homeBuilding
to a BuildingHome
BUT the homeBuilding attribute, can also be a BuildingTownHall.. which cannot be converted into a BuildingHome (Obviously)
btw you might not be able to go back versions, probably screwy NBT stuff
'twas just a temp idea
oh ok, I'll wait a bit, also don't you have like a higher level object you can convert, like using an interface that is referenced in both object, or a parent object you can reference instead of the actual object?
there's a tonne of objects, but no. because the town hall isn't really meant to be a homeBuilding.. it just IS because we have to
well, you could split that home building part into an interface, so you can apply it to a house, the townhall and any other building you would like to be house-like, so if you want a new mansion building, you can apply the interface and implement the methods and properties... same with any other category, just shoving out ideas due to my programmer nature XD, not complaining or anything, I love the mod!
I, or someone else, is going to be doing that soon (i want to rework some of the "housing")
but for a bug fix i should just simply have to change
return (isCitizenHungry() && !((BuildingHome) homeBuilding).isFoodNeeded()) || !(homeBuilding instanceof BuildingHome);
to
return !(homeBuilding instanceof BuildingHome) || (isCitizenHungry() && !((BuildingHome) homeBuilding).isFoodNeeded());
because if it's not an instance of BuildingHome (I.E. buildingTownHall) it's not gonna try the other code, which casts it to a BuildingHome
not an interface though. that's not really the point of an interface (not in our style that is)
Probably just make an abstractBuildingHome
and have that be used by BuildingHome, BuildingTownHall, and etc
Fix is pushed, if i can get you to test the version please ๐ (It fixed it for me, on my test version)
https://teamcity.orionminecraft.com/guestAuth/repository/download/Minecolonies_Branches/4532:id/minecolonies-universal-1.12.2-0.8.4532.jar