ImageWidget.java
net.minecraft.client.gui.components.ImageWidget
信息
- 全限定名:net.minecraft.client.gui.components.ImageWidget
- 类型:public abstract class
- 包:net.minecraft.client.gui.components
- 源码路径:src/main/java/net/minecraft/client/gui/components/ImageWidget.java
- 起始行号:L16
- 继承:AbstractWidget
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
-
net.minecraft.client.gui.components.ImageWidget.Sprite- 类型:
class - 修饰符:
private static - 源码定位:
L50 - 说明:
TODO
- 类型:
-
net.minecraft.client.gui.components.ImageWidget.Texture- 类型:
class - 修饰符:
private static - 源码定位:
L70 - 说明:
TODO
- 类型:
构造器
private ImageWidget(int x, int y, int width, int height) @ L17
- 构造器名:ImageWidget
- 源码定位:L17
- 修饰符:private
参数:
- x: int
- y: int
- width: int
- height: int
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static ImageWidget texture(int width, int height, Identifier texture, int textureWidth, int textureHeight) @ L21
- 方法名:texture
- 源码定位:L21
- 返回类型:ImageWidget
- 修饰符:public static
参数:
- width: int
- height: int
- texture: Identifier
- textureWidth: int
- textureHeight: int
说明:
TODO
public static ImageWidget sprite(int width, int height, Identifier sprite) @ L25
- 方法名:sprite
- 源码定位:L25
- 返回类型:ImageWidget
- 修饰符:public static
参数:
- width: int
- height: int
- sprite: Identifier
说明:
TODO
protected void updateWidgetNarration(NarrationElementOutput output) @ L29
- 方法名:updateWidgetNarration
- 源码定位:L29
- 返回类型:void
- 修饰符:protected
参数:
- output: NarrationElementOutput
说明:
TODO
public void playDownSound(SoundManager soundManager) @ L33
- 方法名:playDownSound
- 源码定位:L33
- 返回类型:void
- 修饰符:public
参数:
- soundManager: SoundManager
说明:
TODO
public boolean isActive() @ L37
- 方法名:isActive
- 源码定位:L37
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public abstract void updateResource(Identifier identifier) @ L42
- 方法名:updateResource
- 源码定位:L42
- 返回类型:void
- 修饰符:public abstract
参数:
- identifier: Identifier
说明:
TODO
public ComponentPath nextFocusPath(FocusNavigationEvent navigationEvent) @ L44
- 方法名:nextFocusPath
- 源码定位:L44
- 返回类型:ComponentPath
- 修饰符:public
参数:
- navigationEvent: FocusNavigationEvent
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public abstract class ImageWidget extends AbstractWidget {
private ImageWidget(int x, int y, int width, int height) {
super(x, y, width, height, CommonComponents.EMPTY);
}
public static ImageWidget texture(int width, int height, Identifier texture, int textureWidth, int textureHeight) {
return new ImageWidget.Texture(0, 0, width, height, texture, textureWidth, textureHeight);
}
public static ImageWidget sprite(int width, int height, Identifier sprite) {
return new ImageWidget.Sprite(0, 0, width, height, sprite);
}
@Override
protected void updateWidgetNarration(NarrationElementOutput output) {
}
@Override
public void playDownSound(SoundManager soundManager) {
}
@Override
public boolean isActive() {
return false;
}
public abstract void updateResource(Identifier identifier);
@Override
public @Nullable ComponentPath nextFocusPath(FocusNavigationEvent navigationEvent) {
return null;
}
@OnlyIn(Dist.CLIENT)
private static class Sprite extends ImageWidget {
private Identifier sprite;
public Sprite(int x, int y, int width, int height, Identifier sprite) {
super(x, y, width, height);
this.sprite = sprite;
}
@Override
public void extractWidgetRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, this.sprite, this.getX(), this.getY(), this.getWidth(), this.getHeight());
}
@Override
public void updateResource(Identifier identifier) {
this.sprite = identifier;
}
}
@OnlyIn(Dist.CLIENT)
private static class Texture extends ImageWidget {
private Identifier texture;
private final int textureWidth;
private final int textureHeight;
public Texture(int x, int y, int width, int height, Identifier texture, int textureWidth, int textureHeight) {
super(x, y, width, height);
this.texture = texture;
this.textureWidth = textureWidth;
this.textureHeight = textureHeight;
}
@Override
protected void extractWidgetRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
graphics.blit(
RenderPipelines.GUI_TEXTURED,
this.texture,
this.getX(),
this.getY(),
0.0F,
0.0F,
this.getWidth(),
this.getHeight(),
this.textureWidth,
this.textureHeight
);
}
@Override
public void updateResource(Identifier identifier) {
this.texture = identifier;
}
}
}引用的其他类
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置: