Package me.desht.pneumaticcraft.api.item
Interface IItemRegistry
- All Known Implementing Classes:
ItemRegistry
public interface IItemRegistry
Get an instance of this with
PneumaticRegistry.IPneumaticCraftInterface.getItemRegistry()-
Method Summary
Modifier and TypeMethodDescriptionbooleandoesItemMatchFilter(net.minecraft.world.item.ItemStack filterStack, net.minecraft.world.item.ItemStack stack, boolean checkDurability, boolean checkNBT, boolean checkModSimilarity) Convenience method to check if an item matches a given filter item.intgetModifiedVolume(net.minecraft.world.item.ItemStack stack, int originalVolume) Get the modified volume for a given item, based on the volume modifiers registered withregisterPneumaticVolumeModifier(ItemVolumeModifier).getSpawnerCoreStats(net.minecraft.world.item.ItemStack stack) Get some information for the given Spawner Core item.makeItemAirHandlerProvider(net.minecraft.world.item.ItemStack stack) Create an instance of PneumaticCraft's default item air handler provider, suitable for returning fromIForgeItem.initCapabilities(ItemStack, CompoundTag).voidregisterInventoryItem(IInventoryItem handler) Register a third-party class that can contain items.voidregisterItemLaunchBehaviour(ILaunchBehaviour behaviour) Register an item launch behaviour for use by the Air Cannon and Pneumatic Chestplate Item Launcher (Dispenser upgrade).voidregisterMagnetSuppressor(IMagnetSuppressor suppressor) Register a magnet suppressor; an object which can prevent the Magnet Upgrade from pulling in (usually item) entities.voidregisterPneumaticVolumeModifier(ItemVolumeModifier modifierFunc) Register a handler to modify the effective volume of a pneumatic item (i.e.
-
Method Details
-
registerInventoryItem
Register a third-party class that can contain items. This is intended for classes from other mods - if it's your class, just make it implementIInventoryItemdirectly.- Parameters:
handler- instance of any class that implementsIInventoryItem
-
registerMagnetSuppressor
Register a magnet suppressor; an object which can prevent the Magnet Upgrade from pulling in (usually item) entities.- Parameters:
suppressor- a suppressor object
-
doesItemMatchFilter
boolean doesItemMatchFilter(@Nonnull net.minecraft.world.item.ItemStack filterStack, @Nonnull net.minecraft.world.item.ItemStack stack, boolean checkDurability, boolean checkNBT, boolean checkModSimilarity) Convenience method to check if an item matches a given filter item. Note that the filtering item (the first parameter) could be a Tag Filter, Classify Filter, or other instance ofIFilteringItem, so parameter order is important; provide the filtering item first, and the item to check second.- Parameters:
filterStack- the item to check againststack- the item being checkedcheckDurability- true if item durability should be taken into accountcheckNBT- true if item NBT should be taken into accountcheckModSimilarity- true to just match by the two items' mod IDs- Returns:
- true if the item passes the filter test, false otherwise
-
registerPneumaticVolumeModifier
Register a handler to modify the effective volume of a pneumatic item (i.e. one that holds air/pressure).- Parameters:
modifierFunc- a volume modifier function
-
getModifiedVolume
int getModifiedVolume(net.minecraft.world.item.ItemStack stack, int originalVolume) Get the modified volume for a given item, based on the volume modifiers registered withregisterPneumaticVolumeModifier(ItemVolumeModifier).- Parameters:
stack- the ItemStack to checkoriginalVolume- the original volume, which is the item's base volume, possibly already modified by Volume Upgrades- Returns:
- the modified volume
-
getSpawnerCoreStats
Get some information for the given Spawner Core item.- Parameters:
stack- an ItemStack, which must be a Spawner Core- Returns:
- a spawner core stats object, to query and manipulate the item
- Throws:
IllegalArgumentException- if the passed ItemStack is not a Spawner Core
-
makeItemAirHandlerProvider
Create an instance of PneumaticCraft's default item air handler provider, suitable for returning fromIForgeItem.initCapabilities(ItemStack, CompoundTag).You can use this method for your own air-handling items, provided that your item implements
IPressurizableItem. If you want to avoid a hard dependency on PneumaticCraft, then create your own custom implementation ofIAirHandlerItem, and attach that implementation to your item viaAttachCapabilitiesEvent.- Parameters:
stack- the ItemStack, whose item must implementIPressurizableItem- Returns:
- an implementation of IAirHandler
- Throws:
IllegalArgumentException- if the stack's item does not implementIPressurizableItem- Implementation Note:
- this air handler stores the item's air amount in the pneumaticcraft:air integer NBT tag
-
registerItemLaunchBehaviour
Register an item launch behaviour for use by the Air Cannon and Pneumatic Chestplate Item Launcher (Dispenser upgrade). Call this from aFMLCommonSetupEventlistener; noenqueueWork()required.- Parameters:
behaviour- the launch behaviour to register
-