Hide ModelQuad from the API

This commit is contained in:
ah-OOG-ah committed 2025-10-07 11:42:25 -04:00
1 parent dc79b68b61
commit cee510a716
2 files changed
+14 -13

No files matched your search

@@ -8,12 +8,14 @@ import static com.gtnewhorizon.gtnhlib.client.renderer.cel.util.ModelQuadUtil.TE
import static com.gtnewhorizon.gtnhlib.client.renderer.cel.util.ModelQuadUtil.vertexOffset;
import static net.minecraft.util.MathHelper.clamp_int;
import com.gtnewhorizon.gtnhlib.client.renderer.cel.model.quad.ModelQuadView;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.renderer.Tessellator;
@@ -138,8 +140,8 @@ public class CapturingTessellator extends Tessellator implements ITessellatorIns
reset();
}
public List<ModelQuad> getQuads() {
return collectedQuads;
public List<ModelQuadView> getQuads() {
return Collections.unmodifiableList(collectedQuads);
}
public void clearQuads() {
@@ -150,7 +152,7 @@ public class CapturingTessellator extends Tessellator implements ITessellatorIns
this.collectedQuads.clear();
}
public static ByteBuffer quadsToBuffer(List<ModelQuad> quads, VertexFormat format) {
public static ByteBuffer quadsToBuffer(List<ModelQuadView> quads, VertexFormat format) {
if (!format.canWriteQuads()) {
throw new IllegalStateException("Vertex format has no quad writer: " + format);
}
@@ -1,15 +1,12 @@
package com.gtnewhorizon.gtnhlib.client.renderer;
import java.nio.ByteBuffer;
import java.util.List;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
import com.gtnewhorizon.gtnhlib.client.renderer.cel.model.quad.ModelQuad;
import com.gtnewhorizon.gtnhlib.client.renderer.cel.model.quad.ModelQuadView;
import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VertexBuffer;
import com.gtnewhorizon.gtnhlib.client.renderer.vertex.VertexFormat;
import java.nio.ByteBuffer;
import java.util.List;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
@SuppressWarnings("unused")
public class TessellatorManager {
@@ -57,7 +54,9 @@ public class TessellatorManager {
/// Stop the CapturingTessellator and return the pooled quads. The quads are valid until clearQuads() is called on
/// the CapturingTesselator, which must be done before starting capturing again.
public static List<ModelQuad> stopCapturingToPooledQuads() {
///
/// @return The quads captured. This list is not copied, and thus should *not* be modified by callers.
public static List<ModelQuadView> stopCapturingToPooledQuads() {
if (!currentlyCapturing.get()) throw new IllegalStateException("Tried to stop capturing when not capturing!");
currentlyCapturing.set(false);
final CapturingTessellator tess = capturingTessellator.get();
@@ -65,7 +64,7 @@ public class TessellatorManager {
// Be sure we got all the quads
if (tess.isDrawing) tess.draw();
final List<ModelQuad> quads = tess.getQuads();
final var quads = tess.getQuads();
tess.discard();
tess.restoreTranslation();