SpellParticleOption.java
net.minecraft.core.particles.SpellParticleOption
信息
- 全限定名:net.minecraft.core.particles.SpellParticleOption
- 类型:public class
- 包:net.minecraft.core.particles
- 源码路径:src/main/java/net/minecraft/core/particles/SpellParticleOption.java
- 起始行号:L12
- 实现:ParticleOptions
- 职责:
TODO
字段/常量
-
type- 类型:
ParticleType<SpellParticleOption> - 修饰符:
private final - 源码定位:
L13 - 说明:
TODO
- 类型:
-
color- 类型:
int - 修饰符:
private final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
power- 类型:
float - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
private SpellParticleOption(ParticleType<SpellParticleOption> type, int color, float power) @ L33
- 构造器名:SpellParticleOption
- 源码定位:L33
- 修饰符:private
参数:
- type: ParticleType
- color: int
- power: float
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static MapCodec<SpellParticleOption> codec(ParticleType<SpellParticleOption> type) @ L17
- 方法名:codec
- 源码定位:L17
- 返回类型:MapCodec
- 修饰符:public static
参数:
- type: ParticleType
说明:
TODO
public static StreamCodec<?super ByteBuf,SpellParticleOption> streamCodec(ParticleType<SpellParticleOption> type) @ L27
- 方法名:streamCodec
- 源码定位:L27
- 返回类型:StreamCodec<?super ByteBuf,SpellParticleOption>
- 修饰符:public static
参数:
- type: ParticleType
说明:
TODO
public ParticleType<SpellParticleOption> getType() @ L39
- 方法名:getType
- 源码定位:L39
- 返回类型:ParticleType
- 修饰符:public
参数:
- 无
说明:
TODO
public float getRed() @ L44
- 方法名:getRed
- 源码定位:L44
- 返回类型:float
- 修饰符:public
参数:
- 无
说明:
TODO
public float getGreen() @ L48
- 方法名:getGreen
- 源码定位:L48
- 返回类型:float
- 修饰符:public
参数:
- 无
说明:
TODO
public float getBlue() @ L52
- 方法名:getBlue
- 源码定位:L52
- 返回类型:float
- 修饰符:public
参数:
- 无
说明:
TODO
public float getPower() @ L56
- 方法名:getPower
- 源码定位:L56
- 返回类型:float
- 修饰符:public
参数:
- 无
说明:
TODO
public static SpellParticleOption create(ParticleType<SpellParticleOption> type, int color, float power) @ L60
- 方法名:create
- 源码定位:L60
- 返回类型:SpellParticleOption
- 修饰符:public static
参数:
- type: ParticleType
- color: int
- power: float
说明:
TODO
public static SpellParticleOption create(ParticleType<SpellParticleOption> type, float red, float green, float blue, float power) @ L64
- 方法名:create
- 源码定位:L64
- 返回类型:SpellParticleOption
- 修饰符:public static
参数:
- type: ParticleType
- red: float
- green: float
- blue: float
- power: float
说明:
TODO
代码
public class SpellParticleOption implements ParticleOptions {
private final ParticleType<SpellParticleOption> type;
private final int color;
private final float power;
public static MapCodec<SpellParticleOption> codec(ParticleType<SpellParticleOption> type) {
return RecordCodecBuilder.mapCodec(
i -> i.group(
ExtraCodecs.RGB_COLOR_CODEC.optionalFieldOf("color", -1).forGetter(o -> o.color),
Codec.FLOAT.optionalFieldOf("power", 1.0F).forGetter(o -> o.power)
)
.apply(i, (color, power) -> new SpellParticleOption(type, color, power))
);
}
public static StreamCodec<? super ByteBuf, SpellParticleOption> streamCodec(ParticleType<SpellParticleOption> type) {
return StreamCodec.composite(
ByteBufCodecs.INT, o -> o.color, ByteBufCodecs.FLOAT, o -> o.power, (color, power) -> new SpellParticleOption(type, color, power)
);
}
private SpellParticleOption(ParticleType<SpellParticleOption> type, int color, float power) {
this.type = type;
this.color = color;
this.power = power;
}
@Override
public ParticleType<SpellParticleOption> getType() {
return this.type;
}
public float getRed() {
return ARGB.red(this.color) / 255.0F;
}
public float getGreen() {
return ARGB.green(this.color) / 255.0F;
}
public float getBlue() {
return ARGB.blue(this.color) / 255.0F;
}
public float getPower() {
return this.power;
}
public static SpellParticleOption create(ParticleType<SpellParticleOption> type, int color, float power) {
return new SpellParticleOption(type, color, power);
}
public static SpellParticleOption create(ParticleType<SpellParticleOption> type, float red, float green, float blue, float power) {
return create(type, ARGB.colorFromFloat(1.0F, red, green, blue), power);
}
}引用的其他类
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置:
-
- 引用位置:
方法调用/返回值 - 关联成员:
StreamCodec.composite()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ARGB.blue(), ARGB.colorFromFloat(), ARGB.green(), ARGB.red()
- 引用位置: