Enum Class ModdedWrenchUtils

java.lang.Object
java.lang.Enum<ModdedWrenchUtils>
me.desht.pneumaticcraft.common.thirdparty.ModdedWrenchUtils
All Implemented Interfaces:
Serializable, Comparable<ModdedWrenchUtils>, Constable, IWrenchRegistry

public enum ModdedWrenchUtils extends Enum<ModdedWrenchUtils> implements IWrenchRegistry
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
     
  • 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
    onWrenchedPost(net.minecraft.world.item.context.UseOnContext ctx, net.minecraft.world.level.block.state.BlockState state)
    Called server-side when a non-PneumaticCraft block has just been wrenched by the Pneumatic Wrench.
    net.minecraft.world.InteractionResult
    onWrenchedPre(net.minecraft.world.item.context.UseOnContext ctx, net.minecraft.world.level.block.state.BlockState state)
    Called server-side when a non-PneumaticCraft block is about to be wrenched by the Pneumatic Wrench.
    void
    registerWrench(net.minecraft.world.item.Item wrench)
    Register the given item as a wrench, as far as PneumaticCraft is concerned.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

  • Method Details

    • values

      public static ModdedWrenchUtils[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ModdedWrenchUtils valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getInstance

      public static ModdedWrenchUtils getInstance()
    • isModdedWrench

      public boolean isModdedWrench(@Nonnull net.minecraft.world.item.ItemStack stack)
      Description copied from interface: IWrenchRegistry
      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.
      Specified by:
      isModdedWrench in interface IWrenchRegistry
      Parameters:
      stack - the item to check
      Returns:
      true if it's a modded wrench, false otherwise
    • isWrench

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

      public void registerWrench(net.minecraft.world.item.Item wrench)
      Description copied from interface: IWrenchRegistry
      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.
      Specified by:
      registerWrench in interface IWrenchRegistry
      Parameters:
      wrench - a wrench item
    • addModdedWrenchBehaviour

      public 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)
      Description copied from interface: IWrenchRegistry
      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).

      Specified by:
      addModdedWrenchBehaviour in interface IWrenchRegistry
      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
    • onWrenchedPre

      public net.minecraft.world.InteractionResult onWrenchedPre(net.minecraft.world.item.context.UseOnContext ctx, net.minecraft.world.level.block.state.BlockState state)
      Called server-side when a non-PneumaticCraft block is about to be wrenched by the Pneumatic Wrench. Possibly run any mod-specific behaviour on it.
      Parameters:
      ctx - the item usage context
      state - the block being wrenched
      Returns:
      the action result; if SUCCESS or CONSUME, then Pneumatic Wrenching behaviour will not be carried out; if CONSUME then the Pneumatic Wrench sound effect will also not be played
    • onWrenchedPost

      public void onWrenchedPost(net.minecraft.world.item.context.UseOnContext ctx, net.minecraft.world.level.block.state.BlockState state)
      Called server-side when a non-PneumaticCraft block has just been wrenched by the Pneumatic Wrench. Will not be called if onWrenchedPre(UseOnContext, BlockState) returned SUCCESS or CONSUME.
      Parameters:
      ctx - the item usage context
      state - the block being wrenched