PlainTextButton.java
net.minecraft.client.gui.components.PlainTextButton
信息
- 全限定名:net.minecraft.client.gui.components.PlainTextButton
- 类型:public class
- 包:net.minecraft.client.gui.components
- 源码路径:src/main/java/net/minecraft/client/gui/components/PlainTextButton.java
- 起始行号:L13
- 继承:Button
- 职责:
TODO
字段/常量
-
font- 类型:
Font - 修饰符:
private final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
message- 类型:
Component - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
underlinedMessage- 类型:
Component - 修饰符:
private final - 源码定位:
L16 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public PlainTextButton(int x, int y, int width, int height, Component message, Button.OnPress onPress, Font font) @ L18
- 构造器名:PlainTextButton
- 源码定位:L18
- 修饰符:public
参数:
- x: int
- y: int
- width: int
- height: int
- message: Component
- onPress: Button.OnPress
- font: Font
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void extractContents(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) @ L25
- 方法名:extractContents
- 源码定位:L25
- 返回类型:void
- 修饰符:public
参数:
- graphics: GuiGraphicsExtractor
- mouseX: int
- mouseY: int
- a: float
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class PlainTextButton extends Button {
private final Font font;
private final Component message;
private final Component underlinedMessage;
public PlainTextButton(int x, int y, int width, int height, Component message, Button.OnPress onPress, Font font) {
super(x, y, width, height, message, onPress, DEFAULT_NARRATION);
this.font = font;
this.message = message;
this.underlinedMessage = ComponentUtils.mergeStyles(message, Style.EMPTY.withUnderlined(true));
}
@Override
public void extractContents(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
Component messageToRender = this.isHoveredOrFocused() ? this.underlinedMessage : this.message;
graphics.text(this.font, messageToRender, this.getX(), this.getY(), 16777215 | Mth.ceil(this.alpha * 255.0F) << 24);
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/继承
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ComponentUtils.mergeStyles()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.ceil()
- 引用位置: