PowerParticleOption.java

net.minecraft.core.particles.PowerParticleOption

信息

  • 全限定名:net.minecraft.core.particles.PowerParticleOption
  • 类型:public class
  • 包:net.minecraft.core.particles
  • 源码路径:src/main/java/net/minecraft/core/particles/PowerParticleOption.java
  • 起始行号:L9
  • 实现:ParticleOptions
  • 职责:

    TODO

字段/常量

  • type

    • 类型: ParticleType<PowerParticleOption>
    • 修饰符: private final
    • 源码定位: L10
    • 说明:

      TODO

  • power

    • 类型: float
    • 修饰符: private final
    • 源码定位: L11
    • 说明:

      TODO

内部类/嵌套类型

构造器

private PowerParticleOption(ParticleType<PowerParticleOption> type, float power) @ L21

  • 构造器名:PowerParticleOption
  • 源码定位:L21
  • 修饰符:private

参数:

  • type: ParticleType
  • power: float

说明:

TODO

方法

下面的方法块按源码顺序生成。

public static MapCodec<PowerParticleOption> codec(ParticleType<PowerParticleOption> type) @ L13

  • 方法名:codec
  • 源码定位:L13
  • 返回类型:MapCodec
  • 修饰符:public static

参数:

  • type: ParticleType

说明:

TODO

public static StreamCodec<?super ByteBuf,PowerParticleOption> streamCodec(ParticleType<PowerParticleOption> type) @ L17

  • 方法名:streamCodec
  • 源码定位:L17
  • 返回类型:StreamCodec<?super ByteBuf,PowerParticleOption>
  • 修饰符:public static

参数:

  • type: ParticleType

说明:

TODO

public ParticleType<PowerParticleOption> getType() @ L26

  • 方法名:getType
  • 源码定位:L26
  • 返回类型:ParticleType
  • 修饰符:public

参数:

说明:

TODO

public float getPower() @ L31

  • 方法名:getPower
  • 源码定位:L31
  • 返回类型:float
  • 修饰符:public

参数:

说明:

TODO

public static PowerParticleOption create(ParticleType<PowerParticleOption> type, float power) @ L35

  • 方法名:create
  • 源码定位:L35
  • 返回类型:PowerParticleOption
  • 修饰符:public static

参数:

  • type: ParticleType
  • power: float

说明:

TODO

代码

public class PowerParticleOption implements ParticleOptions {
    private final ParticleType<PowerParticleOption> type;
    private final float power;
 
    public static MapCodec<PowerParticleOption> codec(ParticleType<PowerParticleOption> type) {
        return Codec.FLOAT.xmap(power -> new PowerParticleOption(type, power), o -> o.power).optionalFieldOf("power", create(type, 1.0F));
    }
 
    public static StreamCodec<? super ByteBuf, PowerParticleOption> streamCodec(ParticleType<PowerParticleOption> type) {
        return ByteBufCodecs.FLOAT.map(color -> new PowerParticleOption(type, color), o -> o.power);
    }
 
    private PowerParticleOption(ParticleType<PowerParticleOption> type, float power) {
        this.type = type;
        this.power = power;
    }
 
    @Override
    public ParticleType<PowerParticleOption> getType() {
        return this.type;
    }
 
    public float getPower() {
        return this.power;
    }
 
    public static PowerParticleOption create(ParticleType<PowerParticleOption> type, float power) {
        return new PowerParticleOption(type, power);
    }
}

引用的其他类