Search in sources :

Example 6 with PosBasedInteraction

use of com.minecolonies.coremod.colony.interactionhandling.PosBasedInteraction in project minecolonies by ldtteam.

the class AbstractEntityAIBasic method requestTool.

/**
 * Request the appropriate tool for this block.
 *
 * @param target the blockstate to mine
 * @param pos    the pos to mine
 */
private void requestTool(@NotNull final BlockState target, final BlockPos pos) {
    final IToolType toolType = WorkerUtil.getBestToolForBlock(target, target.getDestroySpeed(world, pos));
    final int required = WorkerUtil.getCorrectHarvestLevelForBlock(target);
    if (getOwnBuilding().getMaxToolLevel() < required && worker.getCitizenData() != null) {
        worker.getCitizenData().triggerInteraction(new PosBasedInteraction(new TranslationTextComponent(BUILDING_LEVEL_TOO_LOW, new ItemStack(target.getBlock()).getHoverName(), pos.getX(), pos.getY(), pos.getZ()), ChatPriority.IMPORTANT, new TranslationTextComponent(BUILDING_LEVEL_TOO_LOW), pos));
    }
    updateToolFlag(toolType, required);
}
Also used : IToolType(com.minecolonies.api.util.constant.IToolType) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) PosBasedInteraction(com.minecolonies.coremod.colony.interactionhandling.PosBasedInteraction) ItemStack(net.minecraft.item.ItemStack)

Aggregations

PosBasedInteraction (com.minecolonies.coremod.colony.interactionhandling.PosBasedInteraction)6 ItemStack (net.minecraft.item.ItemStack)6 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)6 IBuilding (com.minecolonies.api.colony.buildings.IBuilding)2 IWareHouse (com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse)2 ChatPriority (com.minecolonies.api.colony.interactionhandling.ChatPriority)2 ILocation (com.minecolonies.api.colony.requestsystem.location.ILocation)2 IRequest (com.minecolonies.api.colony.requestsystem.request.IRequest)2 IRequestable (com.minecolonies.api.colony.requestsystem.requestable.IRequestable)2 Delivery (com.minecolonies.api.colony.requestsystem.requestable.deliveryman.Delivery)2 IDeliverymanRequestable (com.minecolonies.api.colony.requestsystem.requestable.deliveryman.IDeliverymanRequestable)2 ItemStorage (com.minecolonies.api.crafting.ItemStorage)2 AITarget (com.minecolonies.api.entity.ai.statemachine.AITarget)2 AIWorkerState (com.minecolonies.api.entity.ai.statemachine.states.AIWorkerState)2 IAIState (com.minecolonies.api.entity.ai.statemachine.states.IAIState)2 VisibleCitizenStatus (com.minecolonies.api.entity.citizen.VisibleCitizenStatus)2 AbstractTileEntityColonyBuilding (com.minecolonies.api.tileentities.AbstractTileEntityColonyBuilding)2 TileEntityColonyBuilding (com.minecolonies.api.tileentities.TileEntityColonyBuilding)2 TileEntityRack (com.minecolonies.api.tileentities.TileEntityRack)2 InventoryUtils (com.minecolonies.api.util.InventoryUtils)2