Port to 1.17-pre1

This commit is contained in:
Jonas Herzig
2021-06-05 18:05:26 +02:00
parent 5f2dca08d1
commit 1802b1a7d0
35 changed files with 582 additions and 225 deletions

View File

@@ -63,7 +63,9 @@ public class BlendMeshBuilder
}
@Override
//#if MC>=10809
//#if MC>=11700
//$$ public void begin(VertexFormat.DrawMode mode, VertexFormat vertexFormat) {
//#elseif MC>=10809
public void begin(int mode, VertexFormat vertexFormat) {
//#else
//$$ public void startDrawing(int mode) {
@@ -148,7 +150,17 @@ public class BlendMeshBuilder
//#endif
}
public static DMesh addBufferToMesh(ByteBuffer buffer, int mode, VertexFormat vertexFormat, DMesh mesh, ReadableVector3f vertOffset) {
public static DMesh addBufferToMesh(
ByteBuffer buffer,
//#if MC>=11700
//$$ VertexFormat.DrawMode mode,
//#else
int mode,
//#endif
VertexFormat vertexFormat,
DMesh mesh,
ReadableVector3f vertOffset
) {
//#if MC>=11400
int vertexCount = buffer.remaining() / vertexFormat.getVertexSize();
//#else
@@ -157,7 +169,18 @@ public class BlendMeshBuilder
return addBufferToMesh(buffer, vertexCount, mode, vertexFormat, mesh, vertOffset);
}
public static DMesh addBufferToMesh(ByteBuffer buffer, int vertexCount, int mode, VertexFormat vertexFormat, DMesh mesh, ReadableVector3f vertOffset) {
public static DMesh addBufferToMesh(
ByteBuffer buffer,
int vertexCount,
//#if MC>=11700
//$$ VertexFormat.DrawMode mode,
//#else
int mode,
//#endif
VertexFormat vertexFormat,
DMesh mesh,
ReadableVector3f vertOffset
) {
if (mesh == null) {
mesh = new DMesh();
}
@@ -261,7 +284,11 @@ public class BlendMeshBuilder
// Bundle vertices into shapes and add them to the mesh
switch (mode) {
//#if MC>=11700
//$$ case TRIANGLES:
//#else
case GL11.GL_TRIANGLES:
//#endif
for (int i = 0; i < vertices.size(); i+=3) {
mesh.addTriangle(
vertices.get(i ),
@@ -277,7 +304,11 @@ public class BlendMeshBuilder
);
}
break;
//#if MC>=11700
//$$ case QUADS:
//#else
case GL11.GL_QUADS:
//#endif
for (int i = 0; i < vertices.size(); i+=4) {
mesh.addQuad(
vertices.get(i ),

View File

@@ -11,6 +11,7 @@ import com.replaymod.render.blend.mixin.ParticleAccessor;
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Matrix4f;
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f;
import net.minecraft.client.MinecraftClient;
import org.lwjgl.opengl.GL11;
//#if MC>=11400
import net.minecraft.util.math.Vec3d;
@@ -169,7 +170,7 @@ public class ParticlesExporter implements Exporter {
builder.setReverseOffset(offset);
builder.setWellBehaved(true);
//#if MC>=10809
builder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR_LIGHT);
builder.begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE_COLOR_LIGHT);
//#else
//$$ builder.startDrawingQuads();
//#endif