2025-11-24 22:52:51 +03:00

51 lines
1.6 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* org.jspecify.annotations.Nullable
*/
package net.minecraft.network.protocol.game;
import net.minecraft.network.FriendlyByteBuf;
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.entity.Entity;
import net.minecraft.world.level.Level;
import org.jspecify.annotations.Nullable;
public class ClientboundSetCameraPacket
implements Packet<ClientGamePacketListener> {
public static final StreamCodec<FriendlyByteBuf, ClientboundSetCameraPacket> STREAM_CODEC = Packet.codec(ClientboundSetCameraPacket::write, ClientboundSetCameraPacket::new);
private final int cameraId;
public ClientboundSetCameraPacket(Entity camera) {
this.cameraId = camera.getId();
}
private ClientboundSetCameraPacket(FriendlyByteBuf input) {
this.cameraId = input.readVarInt();
}
private void write(FriendlyByteBuf output) {
output.writeVarInt(this.cameraId);
}
@Override
public PacketType<ClientboundSetCameraPacket> type() {
return GamePacketTypes.CLIENTBOUND_SET_CAMERA;
}
@Override
public void handle(ClientGamePacketListener listener) {
listener.handleSetCamera(this);
}
public @Nullable Entity getEntity(Level level) {
return level.getEntity(this.cameraId);
}
}