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 TypeMethodDescriptionvoidaddTooltip(PNCUpgrade upgrade, List<net.minecraft.network.chat.Component> tooltip) Deprecated, for removal: This API element is subject to removal in a future version.booleandoesItemMatchFilter(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.Deprecated, for removal: This API element is subject to removal in a future version.makeItemAirHandlerProvider(net.minecraft.world.item.ItemStack stack, float maxPressure) Create an instance of PneumaticCraft's default item air handler provider, suitable for returning fromIForgeItem.initCapabilities(ItemStack, CompoundTag).net.minecraft.world.item.ItemmakeUpgradeItem(Supplier<PNCUpgrade> upgrade, int tier) Deprecated, for removal: This API element is subject to removal in a future version.superceded byIUpgradeRegistry.makeUpgradeItem(Supplier, int)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.voidregisterUpgradeAcceptor(IUpgradeAcceptor upgradeAcceptor) Deprecated, for removal: This API element is subject to removal in a future version.no longer required and is now a no-op; superceded byIUpgradeRegistry
-
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
-
registerUpgradeAcceptor
Deprecated, for removal: This API element is subject to removal in a future version.no longer required and is now a no-op; superceded byIUpgradeRegistryRegister an item or block as being able to accept PneumaticCraft upgrades. This is safe to call in your own mod's init thread.- Parameters:
upgradeAcceptor- the upgrade acceptor
-
makeUpgradeItem
@Deprecated(forRemoval=true) net.minecraft.world.item.Item makeUpgradeItem(Supplier<PNCUpgrade> upgrade, int tier) Deprecated, for removal: This API element is subject to removal in a future version.superceded byIUpgradeRegistry.makeUpgradeItem(Supplier, int)Convenience method to create an Item implementing theIUpgradeIteminterface, which can be used as a PneumaticCraft upgrade. This item has the default PneumaticCraft tooltip behaviour in thataddTooltip(PNCUpgrade, List)is called when Shift is held while hovering over the item.You can use this method when registering upgrade items as an alternative to creating an Item which implements
IUpgrad£eItemyourself.- Parameters:
upgrade- a supplier for the upgrade object, which will not yet be registeredtier- upgrade tier of this item- Returns:
- an item
-
addTooltip
@Deprecated(forRemoval=true) void addTooltip(PNCUpgrade upgrade, List<net.minecraft.network.chat.Component> tooltip) Deprecated, for removal: This API element is subject to removal in a future version.superceded byIUpgradeRegistry.addUpgradeTooltip(PNCUpgrade, List)Can be used for custom upgrade items to handle tooltips. This will work for implementors registered viaregisterUpgradeAcceptor(IUpgradeAcceptor). This is intended to be called fromItem.appendHoverText(ItemStack, Level, List, TooltipFlag)method to display which machines and/or items accept it.- Parameters:
upgrade- the upgrade itemtooltip- the tooltip string list to append to
-
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
IAirHandlerItem.Provider makeItemAirHandlerProvider(net.minecraft.world.item.ItemStack stack, float maxPressure) 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 ItemStackmaxPressure- the maximum pressure allowed for the item- Returns:
- an implementation of IAirHandler
- 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
-
getUpgradeRegistry
Deprecated, for removal: This API element is subject to removal in a future version.Get the upgrade registry handler, which can be used to register custom upgrades with block entities, entities and items.- Returns:
- the upgrade registry
-
IUpgradeRegistry.addUpgradeTooltip(PNCUpgrade, List)