Java Code Examples for com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket#getFlags()

The following examples show how to use com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket#getFlags() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpdateBlockSerializer_v354.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, UpdateBlockPacket packet) {
    BedrockUtils.writeBlockPosition(buffer, packet.getBlockPosition());
    VarInts.writeUnsignedInt(buffer, packet.getRuntimeId());
    int flagValue = 0;
    for (Flag flag : packet.getFlags()) {
        flagValue |= (1 << flag.ordinal());
    }
    VarInts.writeUnsignedInt(buffer, flagValue);
    VarInts.writeUnsignedInt(buffer, packet.getDataLayer());
}
 
Example 2
Source File: UpdateBlockSerializer_v354.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, UpdateBlockPacket packet) {
    packet.setBlockPosition(BedrockUtils.readBlockPosition(buffer));
    packet.setRuntimeId(VarInts.readUnsignedInt(buffer));
    int flagValue = VarInts.readUnsignedInt(buffer);
    Set<Flag> flags = packet.getFlags();
    for (Flag flag : Flag.values()) {
        if ((flagValue & (1 << flag.ordinal())) != 0) {
            flags.add(flag);
        }
    }
    packet.setDataLayer(VarInts.readUnsignedInt(buffer));
}
 
Example 3
Source File: UpdateBlockSerializer_v388.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, UpdateBlockPacket packet) {
    BedrockUtils.writeBlockPosition(buffer, packet.getBlockPosition());
    VarInts.writeUnsignedInt(buffer, packet.getRuntimeId());
    int flagValue = 0;
    for (Flag flag : packet.getFlags()) {
        flagValue |= (1 << flag.ordinal());
    }
    VarInts.writeUnsignedInt(buffer, flagValue);
    VarInts.writeUnsignedInt(buffer, packet.getDataLayer());
}
 
Example 4
Source File: UpdateBlockSerializer_v388.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, UpdateBlockPacket packet) {
    packet.setBlockPosition(BedrockUtils.readBlockPosition(buffer));
    packet.setRuntimeId(VarInts.readUnsignedInt(buffer));
    int flagValue = VarInts.readUnsignedInt(buffer);
    Set<Flag> flags = packet.getFlags();
    for (Flag flag : Flag.values()) {
        if ((flagValue & (1 << flag.ordinal())) != 0) {
            flags.add(flag);
        }
    }
    packet.setDataLayer(VarInts.readUnsignedInt(buffer));
}
 
Example 5
Source File: UpdateBlockSerializer_v340.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, UpdateBlockPacket packet) {
    BedrockUtils.writeBlockPosition(buffer, packet.getBlockPosition());
    VarInts.writeUnsignedInt(buffer, packet.getRuntimeId());
    int flagValue = 0;
    for (Flag flag : packet.getFlags()) {
        flagValue |= (1 << flag.ordinal());
    }
    VarInts.writeUnsignedInt(buffer, flagValue);
    VarInts.writeUnsignedInt(buffer, packet.getDataLayer());
}
 
Example 6
Source File: UpdateBlockSerializer_v340.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, UpdateBlockPacket packet) {
    packet.setBlockPosition(BedrockUtils.readBlockPosition(buffer));
    packet.setRuntimeId(VarInts.readUnsignedInt(buffer));
    int flagValue = VarInts.readUnsignedInt(buffer);
    Set<Flag> flags = packet.getFlags();
    for (Flag flag : Flag.values()) {
        if ((flagValue & (1 << flag.ordinal())) != 0) {
            flags.add(flag);
        }
    }
    packet.setDataLayer(VarInts.readUnsignedInt(buffer));
}
 
Example 7
Source File: UpdateBlockSerializer_v313.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, UpdateBlockPacket packet) {
    BedrockUtils.writeBlockPosition(buffer, packet.getBlockPosition());
    VarInts.writeUnsignedInt(buffer, packet.getRuntimeId());
    int flagValue = 0;
    for (Flag flag : packet.getFlags()) {
        flagValue |= (1 << flag.ordinal());
    }
    VarInts.writeUnsignedInt(buffer, flagValue);
    VarInts.writeUnsignedInt(buffer, packet.getDataLayer());
}
 
Example 8
Source File: UpdateBlockSerializer_v313.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, UpdateBlockPacket packet) {
    packet.setBlockPosition(BedrockUtils.readBlockPosition(buffer));
    packet.setRuntimeId(VarInts.readUnsignedInt(buffer));
    int flagValue = VarInts.readUnsignedInt(buffer);
    Set<Flag> flags = packet.getFlags();
    for (Flag flag : Flag.values()) {
        if ((flagValue & (1 << flag.ordinal())) != 0) {
            flags.add(flag);
        }
    }
    packet.setDataLayer(VarInts.readUnsignedInt(buffer));
}
 
Example 9
Source File: UpdateBlockSerializer_v361.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, UpdateBlockPacket packet) {
    BedrockUtils.writeBlockPosition(buffer, packet.getBlockPosition());
    VarInts.writeUnsignedInt(buffer, packet.getRuntimeId());
    int flagValue = 0;
    for (Flag flag : packet.getFlags()) {
        flagValue |= (1 << flag.ordinal());
    }
    VarInts.writeUnsignedInt(buffer, flagValue);
    VarInts.writeUnsignedInt(buffer, packet.getDataLayer());
}
 
Example 10
Source File: UpdateBlockSerializer_v361.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, UpdateBlockPacket packet) {
    packet.setBlockPosition(BedrockUtils.readBlockPosition(buffer));
    packet.setRuntimeId(VarInts.readUnsignedInt(buffer));
    int flagValue = VarInts.readUnsignedInt(buffer);
    Set<Flag> flags = packet.getFlags();
    for (Flag flag : Flag.values()) {
        if ((flagValue & (1 << flag.ordinal())) != 0) {
            flags.add(flag);
        }
    }
    packet.setDataLayer(VarInts.readUnsignedInt(buffer));
}
 
Example 11
Source File: UpdateBlockSerializer_v332.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, UpdateBlockPacket packet) {
    BedrockUtils.writeBlockPosition(buffer, packet.getBlockPosition());
    VarInts.writeUnsignedInt(buffer, packet.getRuntimeId());
    int flagValue = 0;
    for (Flag flag : packet.getFlags()) {
        flagValue |= (1 << flag.ordinal());
    }
    VarInts.writeUnsignedInt(buffer, flagValue);
    VarInts.writeUnsignedInt(buffer, packet.getDataLayer());
}
 
Example 12
Source File: UpdateBlockSerializer_v332.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, UpdateBlockPacket packet) {
    packet.setBlockPosition(BedrockUtils.readBlockPosition(buffer));
    packet.setRuntimeId(VarInts.readUnsignedInt(buffer));
    int flagValue = VarInts.readUnsignedInt(buffer);
    Set<Flag> flags = packet.getFlags();
    for (Flag flag : Flag.values()) {
        if ((flagValue & (1 << flag.ordinal())) != 0) {
            flags.add(flag);
        }
    }
    packet.setDataLayer(VarInts.readUnsignedInt(buffer));
}
 
Example 13
Source File: UpdateBlockSerializer_v291.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void serialize(ByteBuf buffer, UpdateBlockPacket packet) {
    BedrockUtils.writeBlockPosition(buffer, packet.getBlockPosition());
    VarInts.writeUnsignedInt(buffer, packet.getRuntimeId());
    int flagValue = 0;
    for (Flag flag : packet.getFlags()) {
        flagValue |= (1 << flag.ordinal());
    }
    VarInts.writeUnsignedInt(buffer, flagValue);
    VarInts.writeUnsignedInt(buffer, packet.getDataLayer());
}
 
Example 14
Source File: UpdateBlockSerializer_v291.java    From Protocol with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(ByteBuf buffer, UpdateBlockPacket packet) {
    packet.setBlockPosition(BedrockUtils.readBlockPosition(buffer));
    packet.setRuntimeId(VarInts.readUnsignedInt(buffer));
    int flagValue = VarInts.readUnsignedInt(buffer);
    Set<Flag> flags = packet.getFlags();
    for (Flag flag : Flag.values()) {
        if ((flagValue & (1 << flag.ordinal())) != 0) {
            flags.add(flag);
        }
    }
    packet.setDataLayer(VarInts.readUnsignedInt(buffer));
}