CraftTweaker

CraftTweaker

151M Downloads

[1.18] Method to create empty ListData

vertexcubed opened this issue ยท 3 comments

commented

Describe the feature you'd like

Simple method to create an empty ListData, as the default constructor for it is broken.

Example implementation in ZC:

public expand ListData {
    public static create() as ListData => {
        val data = [""] as ListData;
        data.clear();
        return data;
    }

Describe alternatives you've considered

Alternative is to tell people to manually implement something along the lines of this every time someone asks, or backport the fix which could be a breaking change

Additional context

No response

Minecraft version

1.18

Modloader

Forge

commented

as the default constructor for it is broken.

What exactly about the ctor is broken?

In any case, there are 2 ctors exposed to ZC.
Which of these does not work and what is the error you get?

val listData1 = new ListData();
val listData2 = new ListData([]);
commented

The first ctor with no parameters doesn't seem to work, refer to this discord thread for more context. I'm not sure what the exact bug/issue is but Jared should know

commented

Closed by 68e4d5f