73 lines
2.2 KiB
Java
73 lines
2.2 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.network.protocol.game;
|
|
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.core.registries.Registries;
|
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
|
import net.minecraft.network.codec.ByteBufCodecs;
|
|
import net.minecraft.network.codec.StreamCodec;
|
|
import net.minecraft.network.protocol.Packet;
|
|
import net.minecraft.network.protocol.PacketType;
|
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
|
import net.minecraft.network.protocol.game.GamePacketTypes;
|
|
import net.minecraft.world.level.block.Block;
|
|
|
|
public class ClientboundBlockEventPacket
|
|
implements Packet<ClientGamePacketListener> {
|
|
public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundBlockEventPacket> STREAM_CODEC = Packet.codec(ClientboundBlockEventPacket::write, ClientboundBlockEventPacket::new);
|
|
private final BlockPos pos;
|
|
private final int b0;
|
|
private final int b1;
|
|
private final Block block;
|
|
|
|
public ClientboundBlockEventPacket(BlockPos pos, Block block, int b0, int b1) {
|
|
this.pos = pos;
|
|
this.block = block;
|
|
this.b0 = b0;
|
|
this.b1 = b1;
|
|
}
|
|
|
|
private ClientboundBlockEventPacket(RegistryFriendlyByteBuf input) {
|
|
this.pos = input.readBlockPos();
|
|
this.b0 = input.readUnsignedByte();
|
|
this.b1 = input.readUnsignedByte();
|
|
this.block = (Block)ByteBufCodecs.registry(Registries.BLOCK).decode(input);
|
|
}
|
|
|
|
private void write(RegistryFriendlyByteBuf output) {
|
|
output.writeBlockPos(this.pos);
|
|
output.writeByte(this.b0);
|
|
output.writeByte(this.b1);
|
|
ByteBufCodecs.registry(Registries.BLOCK).encode(output, this.block);
|
|
}
|
|
|
|
@Override
|
|
public PacketType<ClientboundBlockEventPacket> type() {
|
|
return GamePacketTypes.CLIENTBOUND_BLOCK_EVENT;
|
|
}
|
|
|
|
@Override
|
|
public void handle(ClientGamePacketListener listener) {
|
|
listener.handleBlockEvent(this);
|
|
}
|
|
|
|
public BlockPos getPos() {
|
|
return this.pos;
|
|
}
|
|
|
|
public int getB0() {
|
|
return this.b0;
|
|
}
|
|
|
|
public int getB1() {
|
|
return this.b1;
|
|
}
|
|
|
|
public Block getBlock() {
|
|
return this.block;
|
|
}
|
|
}
|
|
|