package net.minecraft.network.protocol.game;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.Packet;

public class ClientboundSetTimePacket implements Packet<ClientGamePacketListener> {
    private long gameTime;
    private long dayTime;
    
    public ClientboundSetTimePacket() {
    }
    
    public ClientboundSetTimePacket(final long long1, final long long2, final boolean boolean3) {
        this.gameTime = long1;
        this.dayTime = long2;
        if (!boolean3) {
            this.dayTime = -this.dayTime;
            if (this.dayTime == 0L) {
                this.dayTime = -1L;
            }
        }
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.gameTime = kv.readLong();
        this.dayTime = kv.readLong();
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeLong(this.gameTime);
        kv.writeLong(this.dayTime);
    }
    
    @Override
    public void handle(final ClientGamePacketListener lw) {
        lw.handleSetTime(this);
    }
    
    public long getGameTime() {
        return this.gameTime;
    }
    
    public long getDayTime() {
        return this.dayTime;
    }
}
