28 lines
745 B
Java
28 lines
745 B
Java
package net.minecraft.world;
|
|
|
|
public enum ItemInteractionResult {
|
|
SUCCESS,
|
|
CONSUME,
|
|
CONSUME_PARTIAL,
|
|
PASS_TO_DEFAULT_BLOCK_INTERACTION,
|
|
SKIP_DEFAULT_BLOCK_INTERACTION,
|
|
FAIL;
|
|
|
|
public boolean consumesAction() {
|
|
return this.result().consumesAction();
|
|
}
|
|
|
|
public static ItemInteractionResult sidedSuccess(boolean clientSide) {
|
|
return clientSide ? SUCCESS : CONSUME;
|
|
}
|
|
|
|
public InteractionResult result() {
|
|
return switch (this) {
|
|
case SUCCESS -> InteractionResult.SUCCESS;
|
|
case CONSUME -> InteractionResult.CONSUME;
|
|
case CONSUME_PARTIAL -> InteractionResult.CONSUME_PARTIAL;
|
|
case PASS_TO_DEFAULT_BLOCK_INTERACTION, SKIP_DEFAULT_BLOCK_INTERACTION -> InteractionResult.PASS;
|
|
case FAIL -> InteractionResult.FAIL;
|
|
};
|
|
}
|
|
}
|