Carpet

Carpet

2M Downloads

Polygon shape broken on servers

vlad2305m opened this issue ยท 7 comments

commented

/script run draw_shape('polygon',20,{'points'->[[0,100,0],[0,100,1],[1,100,1]]})
works in singleplayer (returns true and shows the polygon), but gives no output at all on servers. fabric-carpet-1.19.3-1.4.93+v221230

commented

Do you have Carpet mod installed on both the server and client?

commented

Yes. Spheres work as expected in both cases.

commented

The problem is that, instead of just sending the shape to the client, you initialize the shape on the server first. Of course, not all rendering configurations are available on a standalone server ;)
Just replacing the enum values in question with their ordinal solves the issue.

@Environment(EnvType.CLIENT)
    public static enum Mode {
        LINES(4, 2, 2, false),
        LINE_STRIP(5, 2, 1, true),
        DEBUG_LINES(1, 2, 2, false),
        DEBUG_LINE_STRIP(3, 2, 1, true),
        TRIANGLES(4, 3, 3, false),
        TRIANGLE_STRIP(5, 3, 1, true),
        TRIANGLE_FAN(6, 3, 1, true),
        QUADS(4, 4, 4, false);
...
commented
commented

I'm surprised it doesn't crash the server if it's loading a client only class.

commented

probably due to very broad catch around scarpet executions.

I think it warrants cherrypicking to 1.19.3

commented

Then I think we should also backport #1635 and if it's based on the 1.19.3 branch it needs d9a4a62 as there's currently an NPE in there.