CommonPlayerSpawnInfo.java

net.minecraft.network.protocol.game.CommonPlayerSpawnInfo

信息

  • 全限定名:net.minecraft.network.protocol.game.CommonPlayerSpawnInfo
  • 类型:public record
  • 包:net.minecraft.network.protocol.game
  • 源码路径:src/main/java/net/minecraft/network/protocol/game/CommonPlayerSpawnInfo.java
  • 起始行号:L15
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

public CommonPlayerSpawnInfo(RegistryFriendlyByteBuf input) @ L27

  • 构造器名:CommonPlayerSpawnInfo
  • 源码定位:L27
  • 修饰符:public

参数:

  • input: RegistryFriendlyByteBuf

说明:

TODO

方法

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

public void write(RegistryFriendlyByteBuf output) @ L42

  • 方法名:write
  • 源码定位:L42
  • 返回类型:void
  • 修饰符:public

参数:

  • output: RegistryFriendlyByteBuf

说明:

TODO

代码

public record CommonPlayerSpawnInfo(
    Holder<DimensionType> dimensionType,
    ResourceKey<Level> dimension,
    long seed,
    GameType gameType,
    @Nullable GameType previousGameType,
    boolean isDebug,
    boolean isFlat,
    Optional<GlobalPos> lastDeathLocation,
    int portalCooldown,
    int seaLevel
) {
    public CommonPlayerSpawnInfo(RegistryFriendlyByteBuf input) {
        this(
            DimensionType.STREAM_CODEC.decode(input),
            input.readResourceKey(Registries.DIMENSION),
            input.readLong(),
            GameType.byId(input.readByte()),
            GameType.byNullableId(input.readByte()),
            input.readBoolean(),
            input.readBoolean(),
            input.readOptional(FriendlyByteBuf::readGlobalPos),
            input.readVarInt(),
            input.readVarInt()
        );
    }
 
    public void write(RegistryFriendlyByteBuf output) {
        DimensionType.STREAM_CODEC.encode(output, this.dimensionType);
        output.writeResourceKey(this.dimension);
        output.writeLong(this.seed);
        output.writeByte(this.gameType.getId());
        output.writeByte(GameType.getNullableId(this.previousGameType));
        output.writeBoolean(this.isDebug);
        output.writeBoolean(this.isFlat);
        output.writeOptional(this.lastDeathLocation, FriendlyByteBuf::writeGlobalPos);
        output.writeVarInt(this.portalCooldown);
        output.writeVarInt(this.seaLevel);
    }
}

引用的其他类

  • RegistryFriendlyByteBuf

    • 引用位置: 参数
  • GameType

    • 引用位置: 方法调用
    • 关联成员: GameType.byId(), GameType.byNullableId(), GameType.getNullableId()