InputWithModifiers.java

net.minecraft.client.input.InputWithModifiers

信息

  • 全限定名:net.minecraft.client.input.InputWithModifiers
  • 类型:public interface
  • 包:net.minecraft.client.input
  • 源码路径:src/main/java/net/minecraft/client/input/InputWithModifiers.java
  • 起始行号:L12
  • 职责:

    TODO

字段/常量

  • NOT_DIGIT
    • 类型: int
    • 修饰符: package-private
    • 源码定位: L13
    • 说明:

      TODO

内部类/嵌套类型

  • net.minecraft.client.input.InputWithModifiers.Modifiers
    • 类型: annotation
    • 修饰符: public
    • 源码定位: L93
    • 说明:

      TODO

构造器

方法

下面的方法块按源码顺序生成。

int input() @ L15

  • 方法名:input
  • 源码定位:L15
  • 返回类型:int
  • 修饰符:package-private

参数:

说明:

TODO

int modifiers() @ L18

  • 方法名:modifiers
  • 源码定位:L18
  • 返回类型:int
  • 修饰符:package-private

参数:

说明:

TODO

default boolean isSelection() @ L21

  • 方法名:isSelection
  • 源码定位:L21
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isConfirmation() @ L25

  • 方法名:isConfirmation
  • 源码定位:L25
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isEscape() @ L29

  • 方法名:isEscape
  • 源码定位:L29
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isLeft() @ L33

  • 方法名:isLeft
  • 源码定位:L33
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isRight() @ L37

  • 方法名:isRight
  • 源码定位:L37
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isUp() @ L41

  • 方法名:isUp
  • 源码定位:L41
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isDown() @ L45

  • 方法名:isDown
  • 源码定位:L45
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isCycleFocus() @ L49

  • 方法名:isCycleFocus
  • 源码定位:L49
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default int getDigit() @ L53

  • 方法名:getDigit
  • 源码定位:L53
  • 返回类型:int
  • 修饰符:default

参数:

说明:

TODO

default boolean hasAltDown() @ L58

  • 方法名:hasAltDown
  • 源码定位:L58
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean hasShiftDown() @ L62

  • 方法名:hasShiftDown
  • 源码定位:L62
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean hasControlDown() @ L66

  • 方法名:hasControlDown
  • 源码定位:L66
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean hasControlDownWithQuirk() @ L70

  • 方法名:hasControlDownWithQuirk
  • 源码定位:L70
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isSelectAll() @ L74

  • 方法名:isSelectAll
  • 源码定位:L74
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isCopy() @ L78

  • 方法名:isCopy
  • 源码定位:L78
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isPaste() @ L82

  • 方法名:isPaste
  • 源码定位:L82
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

default boolean isCut() @ L86

  • 方法名:isCut
  • 源码定位:L86
  • 返回类型:boolean
  • 修饰符:default

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public interface InputWithModifiers {
    int NOT_DIGIT = -1;
 
    @InputConstants.Value
    int input();
 
    @InputWithModifiers.Modifiers
    int modifiers();
 
    default boolean isSelection() {
        return this.input() == 257 || this.input() == 32 || this.input() == 335;
    }
 
    default boolean isConfirmation() {
        return this.input() == 257 || this.input() == 335;
    }
 
    default boolean isEscape() {
        return this.input() == 256;
    }
 
    default boolean isLeft() {
        return this.input() == 263;
    }
 
    default boolean isRight() {
        return this.input() == 262;
    }
 
    default boolean isUp() {
        return this.input() == 265;
    }
 
    default boolean isDown() {
        return this.input() == 264;
    }
 
    default boolean isCycleFocus() {
        return this.input() == 258;
    }
 
    default int getDigit() {
        int value = this.input() - 48;
        return value >= 0 && value <= 9 ? value : -1;
    }
 
    default boolean hasAltDown() {
        return (this.modifiers() & 4) != 0;
    }
 
    default boolean hasShiftDown() {
        return (this.modifiers() & 1) != 0;
    }
 
    default boolean hasControlDown() {
        return (this.modifiers() & 2) != 0;
    }
 
    default boolean hasControlDownWithQuirk() {
        return (this.modifiers() & InputQuirks.EDIT_SHORTCUT_KEY_MODIFIER) != 0;
    }
 
    default boolean isSelectAll() {
        return this.input() == 65 && this.hasControlDownWithQuirk() && !this.hasShiftDown() && !this.hasAltDown();
    }
 
    default boolean isCopy() {
        return this.input() == 67 && this.hasControlDownWithQuirk() && !this.hasShiftDown() && !this.hasAltDown();
    }
 
    default boolean isPaste() {
        return this.input() == 86 && this.hasControlDownWithQuirk() && !this.hasShiftDown() && !this.hasAltDown();
    }
 
    default boolean isCut() {
        return this.input() == 88 && this.hasControlDownWithQuirk() && !this.hasShiftDown() && !this.hasAltDown();
    }
 
    @Retention(RetentionPolicy.CLASS)
    @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.TYPE_USE})
    @OnlyIn(Dist.CLIENT)
    public @interface Modifiers {
    }
}

引用的其他类