Skip to content

Commit

Permalink
fixed use of client side classes in shape dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
gnembon committed Jan 31, 2023
1 parent d49be89 commit 85f7c64
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/carpet/script/utils/ShapesRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ public void renderLines(PoseStack matrices, Tesselator tessellator, BufferBuilde
}
public static class RenderedPolyface extends RenderedShape<ShapeDispatcher.Polyface>
{
private static final VertexFormat.Mode[] faceIndices = new VertexFormat.Mode[]{
Mode.LINES, Mode.LINE_STRIP, Mode.DEBUG_LINES, Mode.DEBUG_LINE_STRIP, Mode.TRIANGLES, Mode.TRIANGLE_STRIP, Mode.TRIANGLE_FAN, Mode.QUADS};

public RenderedPolyface(Minecraft client, ShapeDispatcher.ExpiringShape shape)
{
super(client, (ShapeDispatcher.Polyface)shape);
Expand All @@ -563,7 +566,7 @@ public void renderFaces(Tesselator tessellator, BufferBuilder bufferBuilder, dou
else
RenderSystem.enableCull();

bufferBuilder.begin(VertexFormat.Mode.values()[shape.mode], DefaultVertexFormat.POSITION_COLOR);
bufferBuilder.begin(faceIndices[shape.mode], DefaultVertexFormat.POSITION_COLOR);
for(int i=0;i<shape.vertex_list.size();i++){
Vec3 vec=shape.vertex_list.get(i);
if(shape.relative.get(i)){
Expand Down

0 comments on commit 85f7c64

Please sign in to comment.