package dev.crucifixbeta.api.events.impl;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

@Environment(EnvType.CLIENT)
public class UpdateRotateEvent {
   private static final UpdateRotateEvent instance = new UpdateRotateEvent();
   private float yaw;
   private float pitch;
   private boolean modified;

   private UpdateRotateEvent() {
   }

   public static UpdateRotateEvent get(float yaw, float pitch) {
      instance.yaw = yaw;
      instance.pitch = pitch;
      instance.modified = false;
      return instance;
   }

   public float getYaw() {
      return this.yaw;
   }

   public void setYaw(float yaw) {
      this.modified = true;
      this.setYawWithoutSync(yaw);
   }

   public float getPitch() {
      return this.pitch;
   }

   public void setPitch(float pitch) {
      this.modified = true;
      this.setPitchWithoutSync(pitch);
   }

   public boolean isModified() {
      return this.modified;
   }

   public void setRotation(float yaw, float pitch) {
      this.setYaw(yaw);
      this.setPitch(pitch);
   }

   public void setYawWithoutSync(float yaw) {
      this.yaw = yaw;
   }

   public void setPitchWithoutSync(float pitch) {
      this.pitch = pitch;
   }
}
