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
    • 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