use of com.minecolonies.api.tileentities.AbstractScarecrowTileEntity in project minecolonies by Minecolonies.
the class EntityAIWorkFarmer method searchAndAddFields.
/**
* Searches and adds a field that has not been taken yet for the farmer and then adds it to the list.
*/
private void searchAndAddFields() {
final IColony colony = worker.getCitizenColonyHandler().getColony();
if (colony != null) {
@Nullable final AbstractScarecrowTileEntity newField = colony.getBuildingManager().getFreeField(worker.getCitizenData().getId(), world);
if (newField != null) {
newField.setOwner(worker.getCitizenData().getId());
newField.setTaken(true);
newField.setChanged();
final FarmerFieldModule module = getOwnBuilding().getFirstModuleOccurance(FarmerFieldModule.class);
module.addFarmerFields(newField.getPosition());
}
}
}
use of com.minecolonies.api.tileentities.AbstractScarecrowTileEntity in project minecolonies by ldtteam.
the class EntityAIWorkFarmer method searchAndAddFields.
/**
* Searches and adds a field that has not been taken yet for the farmer and then adds it to the list.
*/
private void searchAndAddFields() {
final IColony colony = worker.getCitizenColonyHandler().getColony();
if (colony != null) {
@Nullable final AbstractScarecrowTileEntity newField = colony.getBuildingManager().getFreeField(worker.getCitizenData().getId(), world);
if (newField != null) {
newField.setOwner(worker.getCitizenData().getId());
newField.setTaken(true);
newField.setChanged();
final FarmerFieldModule module = getOwnBuilding().getFirstModuleOccurance(FarmerFieldModule.class);
module.addFarmerFields(newField.getPosition());
}
}
}
Aggregations