Enum Class ModdedWrenchUtils
- All Implemented Interfaces:
Serializable,Comparable<ModdedWrenchUtils>,Constable,IWrenchRegistry
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModdedWrenchBehaviour(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.static ModdedWrenchUtilsbooleanisModdedWrench(net.minecraft.world.item.ItemStack stack) Check if the given item is considered as a modded wrench (so does not include the Pneumatic Wrench).booleanisWrench(net.minecraft.world.item.ItemStack stack) Check if the given item is any known wrench item, including the Pneumatic Wrench.voidonWrenchedPost(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.InteractionResultonWrenchedPre(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.voidregisterWrench(net.minecraft.world.item.Item wrench) Register the given item as a wrench, as far as PneumaticCraft is concerned.static ModdedWrenchUtilsReturns the enum constant of this class with the specified name.static ModdedWrenchUtils[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getInstance
-
isModdedWrench
public boolean isModdedWrench(@Nonnull net.minecraft.world.item.ItemStack stack) Description copied from interface:IWrenchRegistryCheck 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 theforge:tools/wrenchitem tag will also be considered as modded wrenches.- Specified by:
isModdedWrenchin interfaceIWrenchRegistry- 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:IWrenchRegistryCheck if the given item is any known wrench item, including the Pneumatic Wrench.- Specified by:
isWrenchin interfaceIWrenchRegistry- 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:IWrenchRegistryRegister 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 theforge:tools/wrenchitem tag.- Specified by:
registerWrenchin interfaceIWrenchRegistry- 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:IWrenchRegistryRegister a third-party behaviour for when blocks from another mod are wrenched with the Pneumatic Wrench.The return value from
behaviourPreis also returned byIForgeItem.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
behaviourPostwill only be run ifbehaviourPrereturned PASS (i.e. did not suppress the default Pneumatic Wrench behaviour).- Specified by:
addModdedWrenchBehaviourin interfaceIWrenchRegistry- Parameters:
modid- the mod whose blocks to register the behaviour for; must exactly match the mod's namespacebehaviourPre- code to run when blocks from the mod are about to be wrenched with the Pneumatic WrenchbehaviourPost- 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 contextstate- 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 ifonWrenchedPre(UseOnContext, BlockState)returned SUCCESS or CONSUME.- Parameters:
ctx- the item usage contextstate- the block being wrenched
-