Interface IDroneRegistry
- All Known Implementing Classes:
DroneRegistry
public interface IDroneRegistry
Retrieve an instance of this via
PneumaticRegistry.IPneumaticCraftInterface.getDroneRegistry().-
Method Summary
Modifier and TypeMethodDescriptionvoidaddPathfindableBlock(net.minecraft.world.level.block.Block block, IPathfindHandler handler) Normally drones will pathfind through any block that doesn't have any collisions.net.minecraft.world.entity.PathfinderMobdeliverFluidAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraftforge.fluids.FluidStack deliveredFluid) Similar to deliverItemsAmazonStyle, but with Fluids.net.minecraft.world.entity.PathfinderMobdeliverItemsAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraft.world.item.ItemStack... deliveredStacks) Will spawn in a Drone a distance away from the given coordinate.getDrone(net.minecraft.world.level.Level level, int entityID) Get theIDroneAPI object for the given entity IDgetDrone(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) Get theIDroneAPI object for the block entity at the given positionvoidregisterCustomBlockInteractor(ICustomBlockInteract interactor) Register a custom puzzle piece that has only an Area whitelist/blacklist parameter (similar to a Go To piece).net.minecraft.world.entity.PathfinderMobretrieveFluidAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraftforge.fluids.FluidStack queriedFluid) The opposite of deliverFluidAmazonStyle.net.minecraft.world.entity.PathfinderMobretrieveItemsAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraft.world.item.ItemStack... queriedStacks) The opposite of deliverItemsAmazonStyle.
-
Method Details
-
addPathfindableBlock
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.- Parameters:
block- the block to allow pathfinding throughhandler- can be null, to always allow pathfinding through this block.
-
registerCustomBlockInteractor
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.
- Parameters:
interactor- the custom interactor object
-
deliverItemsAmazonStyle
net.minecraft.world.entity.PathfinderMob deliverItemsAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraft.world.item.ItemStack... deliveredStacks) 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.
- Parameters:
globalPos- global position to deliver items todeliveredStacks- 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").
- Throws:
IllegalArgumentException- if the array of ItemStacks is empty or contains more than 36 separate stacks
-
retrieveItemsAmazonStyle
net.minecraft.world.entity.PathfinderMob retrieveItemsAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraft.world.item.ItemStack... queriedStacks) The opposite of deliverItemsAmazonStyle. Will retrieve the queried items from an inventory at the specified location.- Parameters:
globalPos- the global position to retrieve items fromqueriedStacks- the stacks to retrieve- Returns:
- the drone
-
deliverFluidAmazonStyle
net.minecraft.world.entity.PathfinderMob deliverFluidAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraftforge.fluids.FluidStack deliveredFluid) 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.- Parameters:
globalPos- global position to deliver the fluid todeliveredFluid- the fluid to deliver- Returns:
- the drone
- Throws:
IllegalArgumentException- if the FluidStack contains more than 576,000 mB of fluid (the maximum a fully upgraded drone can carry)
-
retrieveFluidAmazonStyle
net.minecraft.world.entity.PathfinderMob retrieveFluidAmazonStyle(net.minecraft.core.GlobalPos globalPos, net.minecraftforge.fluids.FluidStack queriedFluid) The opposite of deliverFluidAmazonStyle. Will retrieve the queried fluid from an IFluidHandler at the specified location.- Parameters:
globalPos- global block position to retrieve fluid fromqueriedFluid- the fluid to retrieve- Returns:
- the drone
-
getDrone
Get theIDroneAPI object for the given entity ID- Parameters:
level- the levelentityID- the entity ID- Returns:
- an IDrone object, or
Optional.empty()if the entity isn't a drone
-
getDrone
Get theIDroneAPI object for the block entity at the given position- Parameters:
level- the levelpos- 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
-