TooltipRenderUtil.java
net.minecraft.client.gui.screens.inventory.tooltip.TooltipRenderUtil
信息
- 全限定名:net.minecraft.client.gui.screens.inventory.tooltip.TooltipRenderUtil
- 类型:public class
- 包:net.minecraft.client.gui.screens.inventory.tooltip
- 源码路径:src/main/java/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
- 起始行号:L11
- 职责:
TODO
字段/常量
-
BACKGROUND_SPRITE- 类型:
Identifier - 修饰符:
private static final - 源码定位:
L12 - 说明:
TODO
- 类型:
-
FRAME_SPRITE- 类型:
Identifier - 修饰符:
private static final - 源码定位:
L13 - 说明:
TODO
- 类型:
-
MOUSE_OFFSET- 类型:
int - 修饰符:
public static final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
PADDING- 类型:
int - 修饰符:
private static final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
PADDING_LEFT- 类型:
int - 修饰符:
public static final - 源码定位:
L16 - 说明:
TODO
- 类型:
-
PADDING_RIGHT- 类型:
int - 修饰符:
public static final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
PADDING_TOP- 类型:
int - 修饰符:
public static final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
PADDING_BOTTOM- 类型:
int - 修饰符:
public static final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
MARGIN- 类型:
int - 修饰符:
private static final - 源码定位:
L20 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public static void extractTooltipBackground(GuiGraphicsExtractor graphics, int x, int y, int w, int h, Identifier style) @ L22
- 方法名:extractTooltipBackground
- 源码定位:L22
- 返回类型:void
- 修饰符:public static
参数:
- graphics: GuiGraphicsExtractor
- x: int
- y: int
- w: int
- h: int
- style: Identifier
说明:
TODO
private static Identifier getBackgroundSprite(Identifier style) @ L31
- 方法名:getBackgroundSprite
- 源码定位:L31
- 返回类型:Identifier
- 修饰符:private static
参数:
- style: Identifier
说明:
TODO
private static Identifier getFrameSprite(Identifier style) @ L35
- 方法名:getFrameSprite
- 源码定位:L35
- 返回类型:Identifier
- 修饰符:private static
参数:
- style: Identifier
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class TooltipRenderUtil {
private static final Identifier BACKGROUND_SPRITE = Identifier.withDefaultNamespace("tooltip/background");
private static final Identifier FRAME_SPRITE = Identifier.withDefaultNamespace("tooltip/frame");
public static final int MOUSE_OFFSET = 12;
private static final int PADDING = 3;
public static final int PADDING_LEFT = 3;
public static final int PADDING_RIGHT = 3;
public static final int PADDING_TOP = 3;
public static final int PADDING_BOTTOM = 3;
private static final int MARGIN = 9;
public static void extractTooltipBackground(GuiGraphicsExtractor graphics, int x, int y, int w, int h, @Nullable Identifier style) {
int x0 = x - 3 - 9;
int y0 = y - 3 - 9;
int paddedWidth = w + 3 + 3 + 18;
int paddedHeight = h + 3 + 3 + 18;
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, getBackgroundSprite(style), x0, y0, paddedWidth, paddedHeight);
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, getFrameSprite(style), x0, y0, paddedWidth, paddedHeight);
}
private static Identifier getBackgroundSprite(@Nullable Identifier style) {
return style == null ? BACKGROUND_SPRITE : style.withPath(path -> "tooltip/" + path + "_background");
}
private static Identifier getFrameSprite(@Nullable Identifier style) {
return style == null ? FRAME_SPRITE : style.withPath(path -> "tooltip/" + path + "_frame");
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/字段/方法调用/返回值 - 关联成员:
Identifier.withDefaultNamespace()
- 引用位置: