use of com.minecolonies.coremod.tileentities.TileEntityCompostedDirt in project minecolonies by ldtteam.
the class EntityAIWorkFlorist method compost.
/**
* Walk to the block to compost and apply compost to it.
*
* @return the next state to go to.
*/
private IAIState compost() {
if (compostPosition == null) {
return START_WORKING;
}
worker.getCitizenData().setVisibleStatus(GARDENING);
if (walkToBlock(compostPosition)) {
return getState();
}
final TileEntity entity = world.getBlockEntity(compostPosition);
if (entity instanceof TileEntityCompostedDirt) {
@Nullable final ItemStack stack = getOwnBuilding().getFlowerToGrow();
if (stack != null) {
if (worker.getRandom().nextInt(200 - getPrimarySkillLevel()) < 0 || InventoryUtils.shrinkItemCountInItemHandler(worker.getInventoryCitizen(), IS_COMPOST)) {
((TileEntityCompostedDirt) entity).compost(PERCENT_CHANGE_FOR_GROWTH - (getOwnBuilding().getBuildingLevel() * 0.01), getOwnBuilding().getFlowerToGrow());
}
} else {
worker.getCitizenData().triggerInteraction(new StandardInteraction(new TranslationTextComponent(NO_FLOWERS_IN_CONFIG), ChatPriority.BLOCKING));
}
}
incrementActionsDone();
worker.decreaseSaturationForContinuousAction();
compostPosition = null;
return START_WORKING;
}
use of com.minecolonies.coremod.tileentities.TileEntityCompostedDirt in project minecolonies by Minecolonies.
the class EntityAIWorkFlorist method compost.
/**
* Walk to the block to compost and apply compost to it.
*
* @return the next state to go to.
*/
private IAIState compost() {
if (compostPosition == null) {
return START_WORKING;
}
worker.getCitizenData().setVisibleStatus(GARDENING);
if (walkToBlock(compostPosition)) {
return getState();
}
final TileEntity entity = world.getBlockEntity(compostPosition);
if (entity instanceof TileEntityCompostedDirt) {
@Nullable final ItemStack stack = building.getFlowerToGrow();
if (stack != null) {
if (worker.getRandom().nextInt(200 - getPrimarySkillLevel()) < 0 || InventoryUtils.shrinkItemCountInItemHandler(worker.getInventoryCitizen(), IS_COMPOST)) {
((TileEntityCompostedDirt) entity).compost(PERCENT_CHANGE_FOR_GROWTH - (building.getBuildingLevel() * 0.01), building.getFlowerToGrow());
}
} else {
worker.getCitizenData().triggerInteraction(new StandardInteraction(new TranslationTextComponent(NO_FLOWERS_IN_CONFIG), ChatPriority.BLOCKING));
}
}
incrementActionsDone();
worker.decreaseSaturationForContinuousAction();
compostPosition = null;
return START_WORKING;
}
Aggregations