package net.fabricmc.fabric.impl.client.rendering.world;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.world.WorldExtractionContext;
import net.minecraft.class_11658;
import net.minecraft.class_4184;
import net.minecraft.class_4604;
import net.minecraft.class_638;
import net.minecraft.class_757;
import net.minecraft.class_761;
import net.minecraft.class_9779;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
import org.joml.Matrix4fc;

@Environment(EnvType.CLIENT)
public class WorldExtractionContextImpl implements WorldExtractionContext {
   private class_757 gameRenderer;
   private class_761 worldRenderer;
   private class_11658 worldRenderState;
   private class_638 world;
   private class_4184 camera;
   private @Nullable class_4604 frustum;
   private class_9779 tickCounter;
   private Matrix4f viewMatrix;
   private Matrix4f cullProjectionMatrix;
   private boolean blockOutlines;

   public void prepare(class_757 gameRenderer, class_761 worldRenderer, class_11658 worldRenderState, class_638 world, class_9779 tickCounter, boolean blockOutlines, class_4184 camera, Matrix4f viewMatrix, Matrix4f cullProjectionMatrix) {
      this.gameRenderer = gameRenderer;
      this.worldRenderer = worldRenderer;
      this.worldRenderState = worldRenderState;
      this.world = world;
      this.tickCounter = tickCounter;
      this.blockOutlines = blockOutlines;
      this.camera = camera;
      this.viewMatrix = viewMatrix;
      this.cullProjectionMatrix = cullProjectionMatrix;
      this.frustum = null;
   }

   public void setFrustum(@Nullable class_4604 frustum) {
      this.frustum = frustum;
   }

   public class_757 gameRenderer() {
      return this.gameRenderer;
   }

   public class_761 worldRenderer() {
      return this.worldRenderer;
   }

   public class_11658 worldState() {
      return this.worldRenderState;
   }

   public class_638 world() {
      return this.world;
   }

   public class_4184 camera() {
      return this.camera;
   }

   public @Nullable class_4604 frustum() {
      return this.frustum;
   }

   public class_9779 tickCounter() {
      return this.tickCounter;
   }

   public Matrix4fc viewMatrix() {
      return this.viewMatrix;
   }

   public Matrix4fc cullProjectionMatrix() {
      return this.cullProjectionMatrix;
   }

   public boolean blockOutlines() {
      return this.blockOutlines;
   }
}
