PlayerSkinWidget.java
net.minecraft.client.gui.components.PlayerSkinWidget
信息
- 全限定名:net.minecraft.client.gui.components.PlayerSkinWidget
- 类型:public class
- 包:net.minecraft.client.gui.components
- 源码路径:src/main/java/net/minecraft/client/gui/components/PlayerSkinWidget.java
- 起始行号:L22
- 继承:AbstractWidget
- 职责:
TODO
字段/常量
-
MODEL_HEIGHT- 类型:
float - 修饰符:
private static final - 源码定位:
L23 - 说明:
TODO
- 类型:
-
FIT_SCALE- 类型:
float - 修饰符:
private static final - 源码定位:
L24 - 说明:
TODO
- 类型:
-
ROTATION_SENSITIVITY- 类型:
float - 修饰符:
private static final - 源码定位:
L25 - 说明:
TODO
- 类型:
-
DEFAULT_ROTATION_X- 类型:
float - 修饰符:
private static final - 源码定位:
L26 - 说明:
TODO
- 类型:
-
DEFAULT_ROTATION_Y- 类型:
float - 修饰符:
private static final - 源码定位:
L27 - 说明:
TODO
- 类型:
-
ROTATION_X_LIMIT- 类型:
float - 修饰符:
private static final - 源码定位:
L28 - 说明:
TODO
- 类型:
-
wideModel- 类型:
PlayerModel - 修饰符:
private final - 源码定位:
L29 - 说明:
TODO
- 类型:
-
slimModel- 类型:
PlayerModel - 修饰符:
private final - 源码定位:
L30 - 说明:
TODO
- 类型:
-
skin- 类型:
Supplier<PlayerSkin> - 修饰符:
private final - 源码定位:
L31 - 说明:
TODO
- 类型:
-
rotationX- 类型:
float - 修饰符:
private - 源码定位:
L32 - 说明:
TODO
- 类型:
-
rotationY- 类型:
float - 修饰符:
private - 源码定位:
L33 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public PlayerSkinWidget(int width, int height, EntityModelSet models, Supplier<PlayerSkin> skin) @ L35
- 构造器名:PlayerSkinWidget
- 源码定位:L35
- 修饰符:public
参数:
- width: int
- height: int
- models: EntityModelSet
- skin: Supplier
说明:
TODO
方法
下面的方法块按源码顺序生成。
protected void extractWidgetRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) @ L42
- 方法名:extractWidgetRenderState
- 源码定位:L42
- 返回类型:void
- 修饰符:protected
参数:
- graphics: GuiGraphicsExtractor
- mouseX: int
- mouseY: int
- a: float
说明:
TODO
protected void onDrag(MouseButtonEvent event, double dx, double dy) @ L53
- 方法名:onDrag
- 源码定位:L53
- 返回类型:void
- 修饰符:protected
参数:
- event: MouseButtonEvent
- dx: double
- dy: double
说明:
TODO
public void playDownSound(SoundManager soundManager) @ L59
- 方法名:playDownSound
- 源码定位:L59
- 返回类型:void
- 修饰符:public
参数:
- soundManager: SoundManager
说明:
TODO
protected void updateWidgetNarration(NarrationElementOutput output) @ L63
- 方法名:updateWidgetNarration
- 源码定位:L63
- 返回类型:void
- 修饰符:protected
参数:
- output: NarrationElementOutput
说明:
TODO
public ComponentPath nextFocusPath(FocusNavigationEvent navigationEvent) @ L67
- 方法名:nextFocusPath
- 源码定位:L67
- 返回类型:ComponentPath
- 修饰符:public
参数:
- navigationEvent: FocusNavigationEvent
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class PlayerSkinWidget extends AbstractWidget {
private static final float MODEL_HEIGHT = 2.125F;
private static final float FIT_SCALE = 0.97F;
private static final float ROTATION_SENSITIVITY = 2.5F;
private static final float DEFAULT_ROTATION_X = -5.0F;
private static final float DEFAULT_ROTATION_Y = 30.0F;
private static final float ROTATION_X_LIMIT = 50.0F;
private final PlayerModel wideModel;
private final PlayerModel slimModel;
private final Supplier<PlayerSkin> skin;
private float rotationX = -5.0F;
private float rotationY = 30.0F;
public PlayerSkinWidget(int width, int height, EntityModelSet models, Supplier<PlayerSkin> skin) {
super(0, 0, width, height, CommonComponents.EMPTY);
this.wideModel = new PlayerModel(models.bakeLayer(ModelLayers.PLAYER), false);
this.slimModel = new PlayerModel(models.bakeLayer(ModelLayers.PLAYER_SLIM), true);
this.skin = skin;
}
@Override
protected void extractWidgetRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
float scale = 0.97F * this.getHeight() / 2.125F;
float pivotY = -1.0625F;
PlayerSkin skin = this.skin.get();
PlayerModel model = skin.model() == PlayerModelType.SLIM ? this.slimModel : this.wideModel;
graphics.skin(
model, skin.body().texturePath(), scale, this.rotationX, this.rotationY, -1.0625F, this.getX(), this.getY(), this.getRight(), this.getBottom()
);
}
@Override
protected void onDrag(MouseButtonEvent event, double dx, double dy) {
this.rotationX = Mth.clamp(this.rotationX - (float)dy * 2.5F, -50.0F, 50.0F);
this.rotationY += (float)dx * 2.5F;
}
@Override
public void playDownSound(SoundManager soundManager) {
}
@Override
protected void updateWidgetNarration(NarrationElementOutput output) {
}
@Override
public @Nullable ComponentPath nextFocusPath(FocusNavigationEvent navigationEvent) {
return null;
}
}引用的其他类
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
字段/构造调用 - 关联成员:
PlayerModel()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Mth.clamp()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置: