public enum ModdedWrenchUtils extends java.lang.Enum<ModdedWrenchUtils> implements IWrenchRegistry
| Enum Constant and Description |
|---|
INSTANCE |
| Modifier and Type | Method and Description |
|---|---|
void |
addModdedWrenchBehaviour(java.lang.String modid,
java.util.function.BiFunction<net.minecraft.item.ItemUseContext,net.minecraft.block.BlockState,net.minecraft.util.ActionResultType> behaviourPre,
java.util.function.BiConsumer<net.minecraft.item.ItemUseContext,net.minecraft.block.BlockState> behaviourPost)
Register a third-party behaviour for when blocks from another mod are wrenched with the Pneumatic Wrench.
|
static ModdedWrenchUtils |
getInstance() |
boolean |
isModdedWrench(net.minecraft.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.item.ItemStack stack)
Check if the given item is any known wrench item, including the Pneumatic Wrench.
|
void |
onWrenchedPost(net.minecraft.item.ItemUseContext ctx,
net.minecraft.block.BlockState state)
Called server-side when a non-PneumaticCraft block has just been wrenched by the Pneumatic Wrench.
|
net.minecraft.util.ActionResultType |
onWrenchedPre(net.minecraft.item.ItemUseContext ctx,
net.minecraft.block.BlockState state)
Called server-side when a non-PneumaticCraft block is about to be wrenched by the Pneumatic Wrench.
|
void |
registerWrench(net.minecraft.item.Item wrench)
Register the given item as a wrench, as far as PneumaticCraft is concerned.
|
static ModdedWrenchUtils |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static ModdedWrenchUtils[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ModdedWrenchUtils INSTANCE
public static ModdedWrenchUtils[] values()
for (ModdedWrenchUtils c : ModdedWrenchUtils.values()) System.out.println(c);
public static ModdedWrenchUtils valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic static ModdedWrenchUtils getInstance()
public boolean isModdedWrench(@Nonnull
net.minecraft.item.ItemStack stack)
IWrenchRegistryforge:tools/wrench item tag will also be considered as modded wrenches.isModdedWrench in interface IWrenchRegistrystack - the item to checkpublic boolean isWrench(@Nonnull
net.minecraft.item.ItemStack stack)
IWrenchRegistryisWrench in interface IWrenchRegistrystack - the item to checkpublic void registerWrench(net.minecraft.item.Item wrench)
IWrenchRegistryforge:tools/wrench item tag.registerWrench in interface IWrenchRegistrywrench - a wrench itempublic void addModdedWrenchBehaviour(java.lang.String modid,
java.util.function.BiFunction<net.minecraft.item.ItemUseContext,net.minecraft.block.BlockState,net.minecraft.util.ActionResultType> behaviourPre,
java.util.function.BiConsumer<net.minecraft.item.ItemUseContext,net.minecraft.block.BlockState> behaviourPost)
IWrenchRegistry
The return
value from behaviourPre is also returned by IForgeItem.onItemUseFirst(ItemStack, ItemUseContext)
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).
addModdedWrenchBehaviour in interface IWrenchRegistrymodid - 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 Wrenchpublic net.minecraft.util.ActionResultType onWrenchedPre(net.minecraft.item.ItemUseContext ctx,
net.minecraft.block.BlockState state)
ctx - the item usage contextstate - the block being wrenchedpublic void onWrenchedPost(net.minecraft.item.ItemUseContext ctx,
net.minecraft.block.BlockState state)
onWrenchedPre(ItemUseContext, BlockState) returned SUCCESS or CONSUME.ctx - the item usage contextstate - the block being wrenched