TextAlignment.java

net.minecraft.client.gui.TextAlignment

信息

  • 全限定名:net.minecraft.client.gui.TextAlignment
  • 类型:public enum
  • 包:net.minecraft.client.gui
  • 源码路径:src/main/java/net/minecraft/client/gui/TextAlignment.java
  • 起始行号:L8
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

方法

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

LEFT { public int calculateLeft(int anchor, int width) @ L9

  • 方法名:calculateLeft
  • 源码定位:L9
  • 返回类型:LEFT { public int
  • 修饰符:package-private

参数:

  • anchor: int
  • width: int

说明:

TODO

,RIGHT { public int calculateLeft(int anchor, int width) @ L25

  • 方法名:calculateLeft
  • 源码定位:L25
  • 返回类型:,RIGHT { public int
  • 修饰符:package-private

参数:

  • anchor: int
  • width: int

说明:

TODO

public abstract int calculateLeft(int anchor, int width) @ L33

  • 方法名:calculateLeft
  • 源码定位:L33
  • 返回类型:int
  • 修饰符:public abstract

参数:

  • anchor: int
  • width: int

说明:

TODO

public int calculateLeft(int anchor, Font font, FormattedCharSequence text) @ L35

  • 方法名:calculateLeft
  • 源码定位:L35
  • 返回类型:int
  • 修饰符:public

参数:

  • anchor: int
  • font: Font
  • text: FormattedCharSequence

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public enum TextAlignment {
    LEFT {
        @Override
        public int calculateLeft(int anchor, int width) {
            return anchor;
        }
 
        @Override
        public int calculateLeft(int anchor, Font font, FormattedCharSequence text) {
            return anchor;
        }
    },
    CENTER {
        @Override
        public int calculateLeft(int anchor, int width) {
            return anchor - width / 2;
        }
    },
    RIGHT {
        @Override
        public int calculateLeft(int anchor, int width) {
            return anchor - width;
        }
    };
 
    public abstract int calculateLeft(int anchor, int width);
 
    public int calculateLeft(int anchor, Font font, FormattedCharSequence text) {
        return this.calculateLeft(anchor, font.width(text));
    }
}

引用的其他类