public final class Driver
extends java.lang.Object
Environment
- no driver is
needed in that case.
Note that these methods should not be called in the pre-init phase,
since the API.driver
may not have been initialized
at that time. Only start calling these methods in the init phase or later.Network
,
SidedBlock
,
Item
Modifier and Type | Method and Description |
---|---|
static void |
add(Block driver)
Deprecated.
Use
SidedBlock instead. |
static void |
add(Converter converter)
Registers a new type converter.
|
static void |
add(EnvironmentProvider provider)
Register a new environment provider.
|
static void |
add(InventoryProvider provider)
Register a new inventory provider.
|
static void |
add(Item driver)
Registers a new item driver.
|
static void |
add(SidedBlock driver)
Registers a new side-aware block driver.
|
static java.util.Collection<Block> |
blockDrivers()
Get a list of all registered block drivers.
|
static Item |
driverFor(net.minecraft.item.ItemStack stack)
Looks up a driver for the specified item stack.
|
static Item |
driverFor(net.minecraft.item.ItemStack stack,
java.lang.Class<? extends EnvironmentHost> host)
Looks up a driver for the specified item stack.
|
static Block |
driverFor(net.minecraft.world.World world,
int x,
int y,
int z)
Deprecated.
Use
driverFor(World, int, int, int, ForgeDirection) ,
passing UNKNOWN if the side is to be ignored. |
static SidedBlock |
driverFor(net.minecraft.world.World world,
int x,
int y,
int z,
net.minecraftforge.common.util.ForgeDirection side)
Looks up a driver for the block at the specified position in the
specified world.
|
static java.lang.Class<?> |
environmentFor(net.minecraft.item.ItemStack stack)
Deprecated.
Use
environmentsFor(ItemStack) instead. |
static java.util.Set<java.lang.Class<?>> |
environmentsFor(net.minecraft.item.ItemStack stack)
Looks up the environments associated with the specified item stack.
|
static net.minecraft.inventory.IInventory |
inventoryFor(net.minecraft.item.ItemStack stack,
net.minecraft.entity.player.EntityPlayer player)
Get an inventory implementation providing access to an item inventory.
|
static java.util.Collection<Item> |
itemDrivers()
Get a list of all registered item drivers.
|
@Deprecated public static void add(Block driver)
SidedBlock
instead.driver
- the driver to register.public static void add(SidedBlock driver)
driver
- the driver to register.public static void add(Item driver)
driver
- the driver to register.public static void add(Converter converter)
converter
- the converter to register.public static void add(EnvironmentProvider provider)
provider
- the provider to register.public static void add(InventoryProvider provider)
provider
- the provider to register.@Deprecated public static Block driverFor(net.minecraft.world.World world, int x, int y, int z)
driverFor(World, int, int, int, ForgeDirection)
,
passing UNKNOWN if the side is to be ignored.add(li.cil.oc.api.driver.Block)
.world
- the world containing the block.x
- the X coordinate of the block.y
- the Y coordinate of the block.z
- the Z coordinate of the block.public static SidedBlock driverFor(net.minecraft.world.World world, int x, int y, int z, net.minecraftforge.common.util.ForgeDirection side)
add(li.cil.oc.api.driver.Block)
.world
- the world containing the block.x
- the X coordinate of the block.y
- the Y coordinate of the block.z
- the Z coordinate of the block.public static Item driverFor(net.minecraft.item.ItemStack stack, java.lang.Class<? extends EnvironmentHost> host)
stack
- the item stack to get a driver for.host
- the type that will host the environment created by returned driver.public static Item driverFor(net.minecraft.item.ItemStack stack)
stack
- the item stack to get a driver for.@Deprecated public static java.lang.Class<?> environmentFor(net.minecraft.item.ItemStack stack)
environmentsFor(ItemStack)
instead.EnvironmentProvider
s to find
an environment type for the specified item stack. If none can be
found, returns null.stack
- the item stack to get the environment type for.public static java.util.Set<java.lang.Class<?>> environmentsFor(net.minecraft.item.ItemStack stack)
EnvironmentProvider
s to find
environment types for the specified item stack. If none can be
found, returns an empty Set.stack
- the item stack to get the environment type for.public static net.minecraft.inventory.IInventory inventoryFor(net.minecraft.item.ItemStack stack, net.minecraft.entity.player.EntityPlayer player)
InventoryProvider
s to find an
inventory implementation providing access to the specified stack.
If none can be found, returns null.
Note that the specified player may be null, but will usually
be the fake player of the agent making use of this API.stack
- the item stack to get the inventory access for.player
- the player holding the item. May be null.public static java.util.Collection<Block> blockDrivers()
public static java.util.Collection<Item> itemDrivers()