Enum Class DroneRegistry

java.lang.Object
java.lang.Enum<DroneRegistry>
me.desht.pneumaticcraft.common.drone.DroneRegistry
All Implemented Interfaces:
Serializable, Comparable<DroneRegistry>, Constable, IDroneRegistry

public enum DroneRegistry extends Enum<DroneRegistry> implements IDroneRegistry
  • Enum Constant Details

  • Field Details

    • pathfindableBlocks

      public final Map<net.minecraft.world.level.block.Block,IPathfindHandler> pathfindableBlocks
  • Method Details

    • values

      public static DroneRegistry[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DroneRegistry valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getInstance

      public static DroneRegistry getInstance()
    • addPathfindableBlock

      public void addPathfindableBlock(net.minecraft.world.level.block.Block block, IPathfindHandler handler)
      Description copied from interface: IDroneRegistry
      Normally drones will pathfind through any block that doesn't have any collisions. With this method you can register custom blocks to allow the drone to pathfind through them. If the block requires any special handling, e.g. to allow pathfinding under certain conditions, you can pass a IPathFindHandler with the registry.
      Specified by:
      addPathfindableBlock in interface IDroneRegistry
      Parameters:
      block - the block to allow pathfinding through
      handler - can be null, to always allow pathfinding through this block.
    • registerCustomBlockInteractor

      public void registerCustomBlockInteractor(ICustomBlockInteract interactor)
      Description copied from interface: IDroneRegistry
      Register a custom puzzle piece that has only an Area whitelist/blacklist parameter (similar to a Go To piece). It will do the specified behaviour. This can be used, for example, to create energy import/export widgets for a custom energy type (i.e. other than Forge Energy).

      Important: this must be called from your mod constructor, i.e. before registries are frozen, since it adds a deferred registration entry.

      Specified by:
      registerCustomBlockInteractor in interface IDroneRegistry
      Parameters:
      interactor - the custom interactor object
    • deliverItemsAmazonStyle

      public net.minecraft.world.entity.PathfinderMob deliverItemsAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraft.world.item.ItemStack... deliveredStacks)
      Description copied from interface: IDroneRegistry
      Will spawn in a Drone a distance away from the given coordinate. When there is an inventory at the given block position, the drone will export the items there. If there is no inventory or items don't fit, the drone will travel to 5 blocks above the specified Y level, and drop the deliveredStacks. When there isn't a clear path for the items to fall, the Drone will deliver at a Y level above the specified Y that is clear. If no clear blocks can be found (when there are only solid blocks), the Drone will drop the items very high up in the air instead.

      When a player attempts to catch the drone (by wrenching it), the drone will only the drop the items that it was delivering (or none if it dropped those items already). The Drone itself will never be dropped.

      Specified by:
      deliverItemsAmazonStyle in interface IDroneRegistry
      Parameters:
      globalPos - global position to deliver items to
      deliveredStacks - stacks to be delivered by the drone
      Returns:
      the drone; you can use this to set a custom name for example (defaults to "Amadron Delivery Drone").
    • retrieveItemsAmazonStyle

      public net.minecraft.world.entity.PathfinderMob retrieveItemsAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraft.world.item.ItemStack... queriedStacks)
      Description copied from interface: IDroneRegistry
      The opposite of deliverItemsAmazonStyle. Will retrieve the queried items from an inventory at the specified location.
      Specified by:
      retrieveItemsAmazonStyle in interface IDroneRegistry
      Parameters:
      globalPos - the global position to retrieve items from
      queriedStacks - the stacks to retrieve
      Returns:
      the drone
    • deliverFluidAmazonStyle

      public net.minecraft.world.entity.PathfinderMob deliverFluidAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraftforge.fluids.FluidStack deliveredFluid)
      Description copied from interface: IDroneRegistry
      Similar to deliverItemsAmazonStyle, but with Fluids. Will spawn in a Drone that will fill an IFluidHandler at the given block position. If the fluid doesn't fit or there isn't a IFluidHandler, the fluid will be lost.
      Specified by:
      deliverFluidAmazonStyle in interface IDroneRegistry
      Parameters:
      globalPos - global position to deliver the fluid to
      deliveredFluid - the fluid to deliver
      Returns:
      the drone
    • retrieveFluidAmazonStyle

      public net.minecraft.world.entity.PathfinderMob retrieveFluidAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraftforge.fluids.FluidStack queriedFluid)
      Description copied from interface: IDroneRegistry
      The opposite of deliverFluidAmazonStyle. Will retrieve the queried fluid from an IFluidHandler at the specified location.
      Specified by:
      retrieveFluidAmazonStyle in interface IDroneRegistry
      Parameters:
      globalPos - global block position to retrieve fluid from
      queriedFluid - the fluid to retrieve
      Returns:
      the drone
    • getDrone

      public Optional<IDrone> getDrone(net.minecraft.world.level.Level level, int entityID)
      Description copied from interface: IDroneRegistry
      Get the IDrone API object for the given entity ID
      Specified by:
      getDrone in interface IDroneRegistry
      Parameters:
      level - the level
      entityID - the entity ID
      Returns:
      an IDrone object, or Optional.empty() if the entity isn't a drone
    • getDrone

      public Optional<IDrone> getDrone(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
      Description copied from interface: IDroneRegistry
      Get the IDrone API object for the block entity at the given position
      Specified by:
      getDrone in interface IDroneRegistry
      Parameters:
      level - the level
      pos - the block entity's position
      Returns:
      an IDrone object, or Optional.empty() if the block entity at the given pos isn't a Programmable Controller