ServerboundSetStructureBlockPacket.java

net.minecraft.network.protocol.game.ServerboundSetStructureBlockPacket

信息

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

    TODO

字段/常量

  • STREAM_CODEC

    • 类型: StreamCodec<FriendlyByteBuf,ServerboundSetStructureBlockPacket>
    • 修饰符: public static final
    • 源码定位: L16
    • 说明:

      TODO

  • FLAG_IGNORE_ENTITIES

    • 类型: int
    • 修饰符: private static final
    • 源码定位: L19
    • 说明:

      TODO

  • FLAG_SHOW_AIR

    • 类型: int
    • 修饰符: private static final
    • 源码定位: L20
    • 说明:

      TODO

  • FLAG_SHOW_BOUNDING_BOX

    • 类型: int
    • 修饰符: private static final
    • 源码定位: L21
    • 说明:

      TODO

  • FLAG_STRICT

    • 类型: int
    • 修饰符: private static final
    • 源码定位: L22
    • 说明:

      TODO

  • pos

    • 类型: BlockPos
    • 修饰符: private final
    • 源码定位: L23
    • 说明:

      TODO

  • updateType

    • 类型: StructureBlockEntity.UpdateType
    • 修饰符: private final
    • 源码定位: L24
    • 说明:

      TODO

  • mode

    • 类型: StructureMode
    • 修饰符: private final
    • 源码定位: L25
    • 说明:

      TODO

  • name

    • 类型: String
    • 修饰符: private final
    • 源码定位: L26
    • 说明:

      TODO

  • offset

    • 类型: BlockPos
    • 修饰符: private final
    • 源码定位: L27
    • 说明:

      TODO

  • size

    • 类型: Vec3i
    • 修饰符: private final
    • 源码定位: L28
    • 说明:

      TODO

  • mirror

    • 类型: Mirror
    • 修饰符: private final
    • 源码定位: L29
    • 说明:

      TODO

  • rotation

    • 类型: Rotation
    • 修饰符: private final
    • 源码定位: L30
    • 说明:

      TODO

  • data

    • 类型: String
    • 修饰符: private final
    • 源码定位: L31
    • 说明:

      TODO

  • ignoreEntities

    • 类型: boolean
    • 修饰符: private final
    • 源码定位: L32
    • 说明:

      TODO

  • strict

    • 类型: boolean
    • 修饰符: private final
    • 源码定位: L33
    • 说明:

      TODO

  • showAir

    • 类型: boolean
    • 修饰符: private final
    • 源码定位: L34
    • 说明:

      TODO

  • showBoundingBox

    • 类型: boolean
    • 修饰符: private final
    • 源码定位: L35
    • 说明:

      TODO

  • integrity

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

      TODO

  • seed

    • 类型: long
    • 修饰符: private final
    • 源码定位: L37
    • 说明:

      TODO

内部类/嵌套类型

构造器

public ServerboundSetStructureBlockPacket(BlockPos pos, StructureBlockEntity.UpdateType updateType, StructureMode mode, String name, BlockPos offset, Vec3i size, Mirror mirror, Rotation rotation, String data, boolean ignoreEntities, boolean strict, boolean showAir, boolean showBoundingBox, float integrity, long seed) @ L39

  • 构造器名:ServerboundSetStructureBlockPacket
  • 源码定位:L39
  • 修饰符:public

参数:

  • pos: BlockPos
  • updateType: StructureBlockEntity.UpdateType
  • mode: StructureMode
  • name: String
  • offset: BlockPos
  • size: Vec3i
  • mirror: Mirror
  • rotation: Rotation
  • data: String
  • ignoreEntities: boolean
  • strict: boolean
  • showAir: boolean
  • showBoundingBox: boolean
  • integrity: float
  • seed: long

说明:

TODO

private ServerboundSetStructureBlockPacket(FriendlyByteBuf input) @ L73

  • 构造器名:ServerboundSetStructureBlockPacket
  • 源码定位:L73
  • 修饰符:private

参数:

  • input: FriendlyByteBuf

说明:

TODO

方法

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

private void write(FriendlyByteBuf output) @ L94

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

参数:

  • output: FriendlyByteBuf

说明:

TODO

public PacketType<ServerboundSetStructureBlockPacket> type() @ L130

  • 方法名:type
  • 源码定位:L130
  • 返回类型:PacketType
  • 修饰符:public

参数:

说明:

TODO

public void handle(ServerGamePacketListener listener) @ L135

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

参数:

  • listener: ServerGamePacketListener

说明:

TODO

public BlockPos getPos() @ L139

  • 方法名:getPos
  • 源码定位:L139
  • 返回类型:BlockPos
  • 修饰符:public

参数:

说明:

TODO

public StructureBlockEntity.UpdateType getUpdateType() @ L143

  • 方法名:getUpdateType
  • 源码定位:L143
  • 返回类型:StructureBlockEntity.UpdateType
  • 修饰符:public

参数:

说明:

TODO

public StructureMode getMode() @ L147

  • 方法名:getMode
  • 源码定位:L147
  • 返回类型:StructureMode
  • 修饰符:public

参数:

说明:

TODO

public String getName() @ L151

  • 方法名:getName
  • 源码定位:L151
  • 返回类型:String
  • 修饰符:public

参数:

说明:

TODO

public BlockPos getOffset() @ L155

  • 方法名:getOffset
  • 源码定位:L155
  • 返回类型:BlockPos
  • 修饰符:public

参数:

说明:

TODO

public Vec3i getSize() @ L159

  • 方法名:getSize
  • 源码定位:L159
  • 返回类型:Vec3i
  • 修饰符:public

参数:

说明:

TODO

public Mirror getMirror() @ L163

  • 方法名:getMirror
  • 源码定位:L163
  • 返回类型:Mirror
  • 修饰符:public

参数:

说明:

TODO

public Rotation getRotation() @ L167

  • 方法名:getRotation
  • 源码定位:L167
  • 返回类型:Rotation
  • 修饰符:public

参数:

说明:

TODO

public String getData() @ L171

  • 方法名:getData
  • 源码定位:L171
  • 返回类型:String
  • 修饰符:public

参数:

说明:

TODO

public boolean isIgnoreEntities() @ L175

  • 方法名:isIgnoreEntities
  • 源码定位:L175
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public boolean isStrict() @ L179

  • 方法名:isStrict
  • 源码定位:L179
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public boolean isShowAir() @ L183

  • 方法名:isShowAir
  • 源码定位:L183
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public boolean isShowBoundingBox() @ L187

  • 方法名:isShowBoundingBox
  • 源码定位:L187
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public float getIntegrity() @ L191

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

参数:

说明:

TODO

public long getSeed() @ L195

  • 方法名:getSeed
  • 源码定位:L195
  • 返回类型:long
  • 修饰符:public

参数:

说明:

TODO

代码

public class ServerboundSetStructureBlockPacket implements Packet<ServerGamePacketListener> {
    public static final StreamCodec<FriendlyByteBuf, ServerboundSetStructureBlockPacket> STREAM_CODEC = Packet.codec(
        ServerboundSetStructureBlockPacket::write, ServerboundSetStructureBlockPacket::new
    );
    private static final int FLAG_IGNORE_ENTITIES = 1;
    private static final int FLAG_SHOW_AIR = 2;
    private static final int FLAG_SHOW_BOUNDING_BOX = 4;
    private static final int FLAG_STRICT = 8;
    private final BlockPos pos;
    private final StructureBlockEntity.UpdateType updateType;
    private final StructureMode mode;
    private final String name;
    private final BlockPos offset;
    private final Vec3i size;
    private final Mirror mirror;
    private final Rotation rotation;
    private final String data;
    private final boolean ignoreEntities;
    private final boolean strict;
    private final boolean showAir;
    private final boolean showBoundingBox;
    private final float integrity;
    private final long seed;
 
    public ServerboundSetStructureBlockPacket(
        BlockPos pos,
        StructureBlockEntity.UpdateType updateType,
        StructureMode mode,
        String name,
        BlockPos offset,
        Vec3i size,
        Mirror mirror,
        Rotation rotation,
        String data,
        boolean ignoreEntities,
        boolean strict,
        boolean showAir,
        boolean showBoundingBox,
        float integrity,
        long seed
    ) {
        this.pos = pos;
        this.updateType = updateType;
        this.mode = mode;
        this.name = name;
        this.offset = offset;
        this.size = size;
        this.mirror = mirror;
        this.rotation = rotation;
        this.data = data;
        this.ignoreEntities = ignoreEntities;
        this.strict = strict;
        this.showAir = showAir;
        this.showBoundingBox = showBoundingBox;
        this.integrity = integrity;
        this.seed = seed;
    }
 
    private ServerboundSetStructureBlockPacket(FriendlyByteBuf input) {
        this.pos = input.readBlockPos();
        this.updateType = input.readEnum(StructureBlockEntity.UpdateType.class);
        this.mode = input.readEnum(StructureMode.class);
        this.name = input.readUtf();
        int maxOffset = 48;
        this.offset = new BlockPos(Mth.clamp(input.readByte(), -48, 48), Mth.clamp(input.readByte(), -48, 48), Mth.clamp(input.readByte(), -48, 48));
        int maxSize = 48;
        this.size = new Vec3i(Mth.clamp(input.readByte(), 0, 48), Mth.clamp(input.readByte(), 0, 48), Mth.clamp(input.readByte(), 0, 48));
        this.mirror = input.readEnum(Mirror.class);
        this.rotation = input.readEnum(Rotation.class);
        this.data = input.readUtf(128);
        this.integrity = Mth.clamp(input.readFloat(), 0.0F, 1.0F);
        this.seed = input.readVarLong();
        int flags = input.readByte();
        this.ignoreEntities = (flags & 1) != 0;
        this.strict = (flags & 8) != 0;
        this.showAir = (flags & 2) != 0;
        this.showBoundingBox = (flags & 4) != 0;
    }
 
    private void write(FriendlyByteBuf output) {
        output.writeBlockPos(this.pos);
        output.writeEnum(this.updateType);
        output.writeEnum(this.mode);
        output.writeUtf(this.name);
        output.writeByte(this.offset.getX());
        output.writeByte(this.offset.getY());
        output.writeByte(this.offset.getZ());
        output.writeByte(this.size.getX());
        output.writeByte(this.size.getY());
        output.writeByte(this.size.getZ());
        output.writeEnum(this.mirror);
        output.writeEnum(this.rotation);
        output.writeUtf(this.data);
        output.writeFloat(this.integrity);
        output.writeVarLong(this.seed);
        int flags = 0;
        if (this.ignoreEntities) {
            flags |= 1;
        }
 
        if (this.showAir) {
            flags |= 2;
        }
 
        if (this.showBoundingBox) {
            flags |= 4;
        }
 
        if (this.strict) {
            flags |= 8;
        }
 
        output.writeByte(flags);
    }
 
    @Override
    public PacketType<ServerboundSetStructureBlockPacket> type() {
        return GamePacketTypes.SERVERBOUND_SET_STRUCTURE_BLOCK;
    }
 
    public void handle(ServerGamePacketListener listener) {
        listener.handleSetStructureBlock(this);
    }
 
    public BlockPos getPos() {
        return this.pos;
    }
 
    public StructureBlockEntity.UpdateType getUpdateType() {
        return this.updateType;
    }
 
    public StructureMode getMode() {
        return this.mode;
    }
 
    public String getName() {
        return this.name;
    }
 
    public BlockPos getOffset() {
        return this.offset;
    }
 
    public Vec3i getSize() {
        return this.size;
    }
 
    public Mirror getMirror() {
        return this.mirror;
    }
 
    public Rotation getRotation() {
        return this.rotation;
    }
 
    public String getData() {
        return this.data;
    }
 
    public boolean isIgnoreEntities() {
        return this.ignoreEntities;
    }
 
    public boolean isStrict() {
        return this.strict;
    }
 
    public boolean isShowAir() {
        return this.showAir;
    }
 
    public boolean isShowBoundingBox() {
        return this.showBoundingBox;
    }
 
    public float getIntegrity() {
        return this.integrity;
    }
 
    public long getSeed() {
        return this.seed;
    }
}

引用的其他类

  • BlockPos

    • 引用位置: 参数/字段/构造调用/返回值
    • 关联成员: BlockPos()
  • Vec3i

    • 引用位置: 参数/字段/构造调用/返回值
    • 关联成员: Vec3i()
  • FriendlyByteBuf

    • 引用位置: 参数/字段
  • StreamCodec

    • 引用位置: 字段
  • Packet

    • 引用位置: 实现/方法调用
    • 关联成员: Packet.codec()
  • PacketType

    • 引用位置: 返回值
  • ServerGamePacketListener

    • 引用位置: 参数
  • Mth

    • 引用位置: 方法调用
    • 关联成员: Mth.clamp()
  • Mirror

    • 引用位置: 参数/字段/返回值
  • Rotation

    • 引用位置: 参数/字段/返回值
  • StructureBlockEntity

    • 引用位置: 参数/字段/返回值
  • StructureMode

    • 引用位置: 参数/字段/返回值