Farmer Not Working
Largeboy31 opened this issue ยท 13 comments
Minecolonies version
minecolonies-universal-1.12.2-0.8.5930
Expected behavior
Farmer not work?
Actual behaviour
he does not go to the field and do not plant fields
@Raycoms I just gave that version a go and now I can't even get into my world, even after rolling back to the version I was using.
Should not the function AbstractEntityAIBasic.checkForToolOrWeapon() return true if the tool is in inventory. Below::: But the check "if (checkForNeededTool(toolType, minimalLevel)) " in the function returns false (meaning the tool is in inventory). so the default return for the function says "FALSE". meaning you don't have the tool.... Seems like it just needs to switch around the two return types. It lets the farmer start working in my build.
The comments say
boolean com.minecolonies.coremod.entity.ai.basic.AbstractEntityAIBasic.checkForToolOrWeapon(@NotNull IToolType toolType)
Ensures that we have a appropriate tool available. Will set needsTool accordingly.
Parameters:toolType type of tool we check for.
Returns:true if we have the tool
Ok. Yeah if that is a mistake then the functions calling this is messed up. Because the function returns false as saying citizen has a tool. While calling function is counting on a true to indicate they have a tool. So Based on what I read through the code.
Based on the code. The fisher many prepareForFishing() it checks if the return is false then assumes the tool is missing.
Lumberjack is the same check if false then tool is not found.
-So the comments of return true if we have tool appears to be correct.
Also, prepareForFarming() function is checking the states of the fields to see what is next to do.
there is a check
else if (currentField.getFieldStage() == Field.FieldStage.HOED && !checkForToolOrWeapon(ToolType.HOE))
to tell it to go plant. This check says if the player doesn't have a hoe then plant. They will never plant a seed.
I noticed. That check is in the wrong place isn't.
if (currentField.getFieldStage() == Field.FieldStage.PLANTED && checkIfShouldExecute(currentField, this::shouldHarvest)) { return FARMER_HARVEST; } else if (currentField.getFieldStage() == Field.FieldStage.HOED) { return canGoPlanting(currentField, building, true); } else if (currentField.getFieldStage() == Field.FieldStage.EMPTY && checkIfShouldExecute(currentField, this::shouldHoe)) { return FARMER_HOE; }
This should work.
The check for the HOE is in the workAtField method so it can be removed anyway.