Interface IWrenchRegistry

All Known Implementing Classes:
ModdedWrenchUtils

public interface IWrenchRegistry
Some utilities for interacting with third-party wrench behaviours. Get an instance of this with PneumaticRegistry.IPneumaticCraftInterface.getWrenchRegistry()
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addModdedWrenchBehaviour(String modid, BiFunction<net.minecraft.world.item.context.UseOnContext,net.minecraft.world.level.block.state.BlockState,net.minecraft.world.InteractionResult> behaviourPre, BiConsumer<net.minecraft.world.item.context.UseOnContext,net.minecraft.world.level.block.state.BlockState> behaviourPost)
    Register a third-party behaviour for when blocks from another mod are wrenched with the Pneumatic Wrench.
    boolean
    isModdedWrench(net.minecraft.world.item.ItemStack stack)
    Check if the given item is considered as a modded wrench (so does not include the Pneumatic Wrench).
    boolean
    isWrench(net.minecraft.world.item.ItemStack stack)
    Check if the given item is any known wrench item, including the Pneumatic Wrench.
    void
    registerWrench(net.minecraft.world.item.Item wrench)
    Register the given item as a wrench, as far as PneumaticCraft is concerned.
  • Method Details

    • isModdedWrench

      boolean isModdedWrench(@Nonnull net.minecraft.world.item.ItemStack stack)
      Check if the given item is considered as a modded wrench (so does not include the Pneumatic Wrench). PneumaticCraft is by default aware of wrenches from several well-known mods. Note that items added to the forge:tools/wrench item tag will also be considered as modded wrenches.
      Parameters:
      stack - the item to check
      Returns:
      true if it's a modded wrench, false otherwise
    • isWrench

      boolean isWrench(@Nonnull net.minecraft.world.item.ItemStack stack)
      Check if the given item is any known wrench item, including the Pneumatic Wrench.
      Parameters:
      stack - the item to check
      Returns:
      true if it's a wrench, false otherwise
    • registerWrench

      void registerWrench(net.minecraft.world.item.Item wrench)
      Register the given item as a wrench, as far as PneumaticCraft is concerned. Note that the preferred way to do this is to add the item to the forge:tools/wrench item tag.
      Parameters:
      wrench - a wrench item
    • addModdedWrenchBehaviour

      void addModdedWrenchBehaviour(String modid, BiFunction<net.minecraft.world.item.context.UseOnContext,net.minecraft.world.level.block.state.BlockState,net.minecraft.world.InteractionResult> behaviourPre, BiConsumer<net.minecraft.world.item.context.UseOnContext,net.minecraft.world.level.block.state.BlockState> behaviourPost)
      Register a third-party behaviour for when blocks from another mod are wrenched with the Pneumatic Wrench.

      The return value from behaviourPre is also returned by IForgeItem.onItemUseFirst(ItemStack, UseOnContext) when the Pneumatic Wrench is used. Any return value other than PASS will suppress the default Pneumatic Wrench behaviour (including air usage); returning CONSUME will also suppress the Pneumatic Wrench's sound effect.

      The code in behaviourPost will only be run if behaviourPre returned PASS (i.e. did not suppress the default Pneumatic Wrench behaviour).

      Parameters:
      modid - the mod whose blocks to register the behaviour for; must exactly match the mod's namespace
      behaviourPre - code to run when blocks from the mod are about to be wrenched with the Pneumatic Wrench
      behaviourPost - code to run when blocks from the mod have just been wrenched with the Pneumatic Wrench