Interface IDrone

All Superinterfaces:
net.minecraftforge.common.capabilities.ICapabilityProvider
All Known Subinterfaces:
IDroneBase
All Known Implementing Classes:
AbstractBasicDroneEntity, AmadroneEntity, CollectorDroneEntity, DroneEntity, GuardDroneEntity, HarvestingDroneEntity, LogisticsDroneEntity, ProgrammableControllerBlockEntity

public interface IDrone extends net.minecraftforge.common.capabilities.ICapabilityProvider
Represents a drone or drone-like object (e.g. a Programmable Controller).

Do not implement this class yourself! Instances of it are available via drone events (AmadronRetrievalEvent, DroneConstructingEvent, DroneSuicideEvent), and via getDrone(...) methods in IDroneRegistry.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    dropItem(net.minecraft.world.item.ItemStack stack)
    Cause the drone to drop the given item at its position.
    List<net.minecraft.world.entity.Entity>
    Get the list of entities currently carried by this drone.
    net.minecraft.core.BlockPos
    Get the position of the drone's controller.
    net.minecraft.core.BlockPos
    Get the blockpos at which this drone was deployed (by player or dispenser).
    net.minecraft.world.phys.Vec3
    Get the drone's exact position.
    int
    getEmittingRedstone(net.minecraft.core.Direction orientation)
     
    net.minecraftforge.common.util.FakePlayer
    Get the fake player object for the drone.
    net.minecraftforge.fluids.IFluidTank
    Get the drone's fluid tank.
    net.minecraftforge.items.IItemHandlerModifiable
    Get the drone's inventory.
    net.minecraft.world.entity.player.Player
    Retrieve the owning player of this drone; i.e.
    Get the UUID of the drone's owner.
    Get the drone's path navigator object.
    net.minecraft.world.entity.ai.goal.GoalSelector
    Get the drone's current collection of tasks.
    int
    Get a count of the installed upgrades of the given type.
    boolean
    Has the drone's normal tasks been overridden by special circumstances? E.g.
    boolean
    isBlockValidPathfindBlock(net.minecraft.core.BlockPos pos)
    Is the given position valid for pathfinding purposes? i.e.
    void
    onItemPickupEvent(net.minecraft.world.entity.item.ItemEntity curPickingUpEntity, int stackSize)
    Called when a drone is picking up an item.
    void
    sendWireframeToClient(net.minecraft.core.BlockPos pos)
    Send a position to the client to be rendered by the Pneumatic Helmet with Entity Tracker.
    void
    setCarryingEntity(net.minecraft.world.entity.Entity entity)
    Make the drone pick up the given entity.
    void
    setDugBlock(net.minecraft.core.BlockPos pos)
    Mark the given block as being dug.
    void
    setEmittingRedstone(net.minecraft.core.Direction orientation, int emittingRedstone)
    Make the drone emit redstone in the given direction from its current position.
    void
    setName(net.minecraft.network.chat.Component string)
    Set the drone's custom name.
    net.minecraft.world.level.Level
    Get the drone's world.

    Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider

    getCapability, getCapability
  • Method Details

    • getUpgrades

      int getUpgrades(PNCUpgrade upgrade)
      Get a count of the installed upgrades of the given type.
      Parameters:
      upgrade - the upgrade to check
      Returns:
      amount of installed upgrades in the drone
    • world

      net.minecraft.world.level.Level world()
      Get the drone's world.
      Returns:
      a world
    • getFluidTank

      net.minecraftforge.fluids.IFluidTank getFluidTank()
      Get the drone's fluid tank. Note that this is also accessible via the ForgeCapabilities.FLUID_HANDLER capability, which should be used in preference.
      Returns:
      a fluid tank
    • getInv

      net.minecraftforge.items.IItemHandlerModifiable getInv()
      Get the drone's inventory. Note that this is also accessible via the ForgeCapabilities.ITEM_HANDLER capability, which should be used in preference.
      Returns:
      an inventory
    • getDronePos

      net.minecraft.world.phys.Vec3 getDronePos()
      Get the drone's exact position.
      Returns:
      the entity position
    • getControllerPos

      net.minecraft.core.BlockPos getControllerPos()
      Get the position of the drone's controller. For actual drone entities, this will always be BlockPos.ZERO. If the drone is actually a Programmable Controller, it will be the controller's block position.
    • getPathNavigator

      IPathNavigator getPathNavigator()
      Get the drone's path navigator object.
      Returns:
      the path navigator
    • sendWireframeToClient

      void sendWireframeToClient(net.minecraft.core.BlockPos pos)
      Send a position to the client to be rendered by the Pneumatic Helmet with Entity Tracker. This is used to highlight blacklisted block positions.
      Parameters:
      pos - a block position
    • getFakePlayer

      net.minecraftforge.common.util.FakePlayer getFakePlayer()
      Get the fake player object for the drone. This will always return null if called client-side.
      Returns:
      a fake player
    • isBlockValidPathfindBlock

      boolean isBlockValidPathfindBlock(net.minecraft.core.BlockPos pos)
      Is the given position valid for pathfinding purposes? i.e. may the drone move through or to it?

      Custom pathfinding functionality may be added via IDroneRegistry.addPathfindableBlock(Block, IPathfindHandler).

      Parameters:
      pos - a block position
      Returns:
      true if the position is valid, false otherwise
    • dropItem

      void dropItem(net.minecraft.world.item.ItemStack stack)
      Cause the drone to drop the given item at its position. The specified item does not need to be in the drone's inventory, nor will it be removed from the drone's inventory if present.
      Parameters:
      stack - the item stack to drop
    • setDugBlock

      void setDugBlock(net.minecraft.core.BlockPos pos)
      Mark the given block as being dug.
      Parameters:
      pos - a block position
    • getTargetAI

      net.minecraft.world.entity.ai.goal.GoalSelector getTargetAI()
      Get the drone's current collection of tasks.
      Returns:
      a vanilla GoalSelector object
    • setEmittingRedstone

      void setEmittingRedstone(net.minecraft.core.Direction orientation, int emittingRedstone)
      Make the drone emit redstone in the given direction from its current position.
      Parameters:
      orientation - the direction to emit
      emittingRedstone - the redstone level
    • getEmittingRedstone

      int getEmittingRedstone(net.minecraft.core.Direction orientation)
    • setName

      void setName(net.minecraft.network.chat.Component string)
      Set the drone's custom name.
      Parameters:
      string - a custom name
    • setCarryingEntity

      void setCarryingEntity(net.minecraft.world.entity.Entity entity)
      Make the drone pick up the given entity. The given entity will be set as a rider of the drone, but it will not have any control over the drone (in fact, its AI is disabled while being carried).
      Parameters:
      entity - an entity to pick up
    • getCarryingEntities

      List<net.minecraft.world.entity.Entity> getCarryingEntities()
      Get the list of entities currently carried by this drone. Note: although this method returns a list, drones currently support only a single carried entity.
      Returns:
      a list of entities
    • isAIOverridden

      boolean isAIOverridden()
      Has the drone's normal tasks been overridden by special circumstances? E.g. drone hacked, or heading to a charging station.
      Returns:
      true if the drone's normal AI has been overridden
    • onItemPickupEvent

      void onItemPickupEvent(net.minecraft.world.entity.item.ItemEntity curPickingUpEntity, int stackSize)
      Called when a drone is picking up an item.
      Parameters:
      curPickingUpEntity - the item entity
      stackSize - the size of the itemstack in the item entity
    • getOwner

      net.minecraft.world.entity.player.Player getOwner()
      Retrieve the owning player of this drone; i.e. the player who deployed the drone. A drone deployed by a Dispenser does not have a valid player owner.
      Returns:
      the owning player; will be null if the owner is offline or the drone was not player-deployed
    • getOwnerUUID

      @Nonnull UUID getOwnerUUID()
      Get the UUID of the drone's owner. This will be non-null even if the owning player is offline. A drone deployed by a Dispenser has an arbitrary owner UUID that was assigned to it when it was spawned.
      Returns:
      the owner's UUID
    • getDeployPos

      net.minecraft.core.BlockPos getDeployPos()
      Get the blockpos at which this drone was deployed (by player or dispenser). For the Programmable Controller, this will simply return the controller's block position.
      Returns:
      the deployment pos