MineColonies

MineColonies

57M Downloads

[crash]

winsrp opened this issue ยท 18 comments

commented

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

  1. 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

https://pastebin.com/vZDb5xav

commented

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)

commented

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)

commented

uh... yeah sure, I'll use 4519, but it kind of has the same text on the changelog.

commented

(We'll fix the bug, i'm just not sure how ray would want it fixed, so i'll leave it for now)

commented

don't you have like a... if citizenhashome then... use townhall, else use home? kind of thing, (vb.net programmer here XD)

commented

4519 crashes as well, I'll use an older one

commented

here, i'll get a quick fix going

commented

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)

commented

btw you might not be able to go back versions, probably screwy NBT stuff
'twas just a temp idea

commented

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?

commented

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

commented

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!

commented

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

commented

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

commented

that's cool we all have preferences when programming, thanks for the quick fix!

commented

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

commented

game loaded so I think it is fixed. thanks

commented

No problemo!