Class DroneAIImExBase<W extends ProgWidgetInventoryBase>
java.lang.Object
net.minecraft.world.entity.ai.goal.Goal
me.desht.pneumaticcraft.common.ai.DroneAIBlockInteraction<W>
me.desht.pneumaticcraft.common.ai.DroneAIImExBase<W>
- All Implemented Interfaces:
IBlockInteractHandler
- Direct Known Subclasses:
DroneAICustomBlockInteract,DroneAIDropItem,DroneAIEnergyExport,DroneAIEnergyImport,DroneAILiquidExport,DroneAILiquidImport,DroneEntityAIInventoryExport,DroneEntityAIInventoryImport
public abstract class DroneAIImExBase<W extends ProgWidgetInventoryBase>
extends DroneAIBlockInteraction<W>
implements IBlockInteractHandler
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.entity.ai.goal.Goal
net.minecraft.world.entity.ai.goal.Goal.Flag -
Field Summary
Fields inherited from class me.desht.pneumaticcraft.common.ai.DroneAIBlockInteraction
drone, progWidget -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanUse()Returns whether the EntityAIBase should begin execution.voiddecreaseCount(int count) WhenIBlockInteractHandler.useCount()returns true, this should be called to notify the amount actually transferred.protected booleandoBlockInteraction(net.minecraft.core.BlockPos pos, double squareDistToBlock) Carry out the actual interaction operation.intWhenIBlockInteractHandler.useCount()returns true, transfer only up to this much of the resource in question.boolean[]getSides()Returns a boolean[6] of all sides, in order D,U,N,S,W,E; you can useDirection.get3DDataValue()to get an index into this array to get the facing direction, or you use theIBlockInteractHandler.isSideAccessible(Direction)convenience method.booleanuseCount()This is controlled by players setting the "Use Count" checkbox in the widget GUI.Methods inherited from class me.desht.pneumaticcraft.common.ai.DroneAIBlockInteraction
abort, addEndingDebugEntry, canContinueToUse, isValidPosition, moveIntoBlock, moveToPositions, respectClaims, setMaxActionsMethods inherited from class net.minecraft.world.entity.ai.goal.Goal
adjustedTickDelay, getFlags, isInterruptable, reducedTickDelay, requiresUpdateEveryTick, setFlags, start, stop, tick, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface me.desht.pneumaticcraft.api.drone.IBlockInteractHandler
abort, isSideAccessible
-
Constructor Details
-
DroneAIImExBase
-
-
Method Details
-
canUse
public boolean canUse()Description copied from class:DroneAIBlockInteractionReturns whether the EntityAIBase should begin execution.- Overrides:
canUsein classDroneAIBlockInteraction<W extends ProgWidgetInventoryBase>
-
decreaseCount
public void decreaseCount(int count) Description copied from interface:IBlockInteractHandlerWhenIBlockInteractHandler.useCount()returns true, this should be called to notify the amount actually transferred.- Specified by:
decreaseCountin interfaceIBlockInteractHandler- Parameters:
count- the amount to notify
-
getRemainingCount
public int getRemainingCount()Description copied from interface:IBlockInteractHandlerWhenIBlockInteractHandler.useCount()returns true, transfer only up to this much of the resource in question.- Specified by:
getRemainingCountin interfaceIBlockInteractHandler- Returns:
- the maximum amount to attempt to transfer
-
doBlockInteraction
protected boolean doBlockInteraction(net.minecraft.core.BlockPos pos, double squareDistToBlock) Description copied from class:DroneAIBlockInteractionCarry out the actual interaction operation. Beware the return value: returning false is usually the right thing to do when the operation succeeded, to indicate to the drone that it shouldn't keep trying this, but instead move on to the next progwidget.- Specified by:
doBlockInteractionin classDroneAIBlockInteraction<W extends ProgWidgetInventoryBase>- Parameters:
pos- the block pos to work onsquareDistToBlock- squared distance from the drone to the block- Returns:
- false if we're done and should stop trying, true to try again next time
-
getSides
public boolean[] getSides()Description copied from interface:IBlockInteractHandlerReturns a boolean[6] of all sides, in order D,U,N,S,W,E; you can useDirection.get3DDataValue()to get an index into this array to get the facing direction, or you use theIBlockInteractHandler.isSideAccessible(Direction)convenience method.- Specified by:
getSidesin interfaceIBlockInteractHandler- Returns:
- an array of booleans indexed by the Direction index
-
useCount
public boolean useCount()Description copied from interface:IBlockInteractHandlerThis is controlled by players setting the "Use Count" checkbox in the widget GUI. When true, the drone is trying to transfer a specific quantity of the resource in question (items/fluid/energy...).- Specified by:
useCountin interfaceIBlockInteractHandler- Returns:
- true if a specific quantity should be imported/exported
-