use of com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingComposter in project minecolonies by ldtteam.
the class EntityAIWorkComposter method decideWhatToDo.
/**
* Method for the AI to decide what to do. Possible actions: harvest barrels, fill barrels or idle
*
* @return the decision it made
*/
private IAIState decideWhatToDo() {
worker.getCitizenStatusHandler().setLatestStatus(new TranslationTextComponent(COM_MINECOLONIES_COREMOD_STATUS_IDLING));
worker.getCitizenData().setVisibleStatus(VisibleCitizenStatus.WORKING);
if (walkToBuilding()) {
setDelay(2);
return getState();
}
final BuildingComposter building = this.getOwnBuilding();
for (final BlockPos barrel : building.getBarrels()) {
final TileEntity te = world.getBlockEntity(barrel);
if (te instanceof TileEntityBarrel) {
this.currentTarget = barrel;
if (((TileEntityBarrel) te).isDone()) {
setDelay(DECIDE_DELAY);
worker.getCitizenData().setVisibleStatus(COMPOST);
return COMPOSTER_HARVEST;
}
}
}
for (final BlockPos barrel : building.getBarrels()) {
final TileEntity te = world.getBlockEntity(barrel);
if (te instanceof TileEntityBarrel && !((TileEntityBarrel) te).checkIfWorking()) {
this.currentTarget = barrel;
setDelay(DECIDE_DELAY);
worker.getCitizenData().setVisibleStatus(COMPOST);
return COMPOSTER_FILL;
}
}
setDelay(DECIDE_DELAY);
return START_WORKING;
}
use of com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingComposter in project minecolonies by Minecolonies.
the class EntityAIWorkComposter method decideWhatToDo.
/**
* Method for the AI to decide what to do. Possible actions: harvest barrels, fill barrels or idle
*
* @return the decision it made
*/
private IAIState decideWhatToDo() {
worker.getCitizenStatusHandler().setLatestStatus(new TranslationTextComponent(COM_MINECOLONIES_COREMOD_STATUS_IDLING));
worker.getCitizenData().setVisibleStatus(VisibleCitizenStatus.WORKING);
if (walkToBuilding()) {
setDelay(2);
return getState();
}
final BuildingComposter building = this.building;
for (final BlockPos barrel : building.getBarrels()) {
final TileEntity te = world.getBlockEntity(barrel);
if (te instanceof TileEntityBarrel) {
this.currentTarget = barrel;
if (((TileEntityBarrel) te).isDone()) {
setDelay(DECIDE_DELAY);
worker.getCitizenData().setVisibleStatus(COMPOST);
return COMPOSTER_HARVEST;
}
}
}
for (final BlockPos barrel : building.getBarrels()) {
final TileEntity te = world.getBlockEntity(barrel);
if (te instanceof TileEntityBarrel && !((TileEntityBarrel) te).checkIfWorking()) {
this.currentTarget = barrel;
setDelay(DECIDE_DELAY);
worker.getCitizenData().setVisibleStatus(COMPOST);
return COMPOSTER_FILL;
}
}
setDelay(DECIDE_DELAY);
return START_WORKING;
}
Aggregations