Interface IItemRegistry

All Known Implementing Classes:
ItemRegistry

public interface IItemRegistry
  • Method Details

    • registerInventoryItem

      void registerInventoryItem(IInventoryItem handler)
      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 implement IInventoryItem directly.
      Parameters:
      handler - instance of any class that implements IInventoryItem
    • registerUpgradeAcceptor

      @Deprecated(forRemoval=true) void registerUpgradeAcceptor(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 by IUpgradeRegistry
      Register 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.
      Convenience method to create an Item implementing the IUpgradeItem interface, which can be used as a PneumaticCraft upgrade. This item has the default PneumaticCraft tooltip behaviour in that addTooltip(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£eItem yourself.

      Parameters:
      upgrade - a supplier for the upgrade object, which will not yet be registered
      tier - 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.
      Can be used for custom upgrade items to handle tooltips. This will work for implementors registered via registerUpgradeAcceptor(IUpgradeAcceptor). This is intended to be called from Item.appendHoverText(ItemStack, Level, List, TooltipFlag) method to display which machines and/or items accept it.
      Parameters:
      upgrade - the upgrade item
      tooltip - the tooltip string list to append to
    • registerMagnetSuppressor

      void registerMagnetSuppressor(IMagnetSuppressor suppressor)
      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 of IFilteringItem, so parameter order is important; provide the filtering item first, and the item to check second.
      Parameters:
      filterStack - the item to check against
      stack - the item being checked
      checkDurability - true if item durability should be taken into account
      checkNBT - true if item NBT should be taken into account
      checkModSimilarity - true to just match by the two items' mod IDs
      Returns:
      true if the item passes the filter test, false otherwise
    • registerPneumaticVolumeModifier

      void registerPneumaticVolumeModifier(ItemVolumeModifier modifierFunc)
      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 with registerPneumaticVolumeModifier(ItemVolumeModifier).
      Parameters:
      stack - the ItemStack to check
      originalVolume - the original volume, which is the item's base volume, possibly already modified by Volume Upgrades
      Returns:
      the modified volume
    • getSpawnerCoreStats

      ISpawnerCoreStats getSpawnerCoreStats(net.minecraft.world.item.ItemStack stack)
      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 from IForgeItem.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 of IAirHandlerItem, and attach that implementation to your item via AttachCapabilitiesEvent.

      Parameters:
      stack - the ItemStack
      maxPressure - 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

      void registerItemLaunchBehaviour(ILaunchBehaviour behaviour)
      Register an item launch behaviour for use by the Air Cannon and Pneumatic Chestplate Item Launcher (Dispenser upgrade). Call this from a FMLCommonSetupEvent listener; no enqueueWork() required.
      Parameters:
      behaviour - the launch behaviour to register
    • getUpgradeRegistry

      @Deprecated(forRemoval=true) IUpgradeRegistry 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