GregTech icon indicating copy to clipboard operation
GregTech copied to clipboard

A mistake about using @ZenProperty

Open Alpaca2s opened this issue 4 years ago • 2 comments

https://github.com/GregTechCE/GregTech/blob/d9e7ed4570b990ed389a6a96589636ced78edd34/src/main/java/gregtech/api/unification/material/type/Material.java#L176-L183 The @ZenProperty can only be applied to public fields.

Alpaca2s avatar Jul 29 '21 12:07 Alpaca2s

That is true.

The problem is making it public would allow people to serverly break things, e.g. see #1673 and related.

And making it read only (final) would break this: https://github.com/GregTechCE/GregTech/blob/d9e7ed4570b990ed389a6a96589636ced78edd34/src/main/java/gregtech/api/unification/material/type/Material.java#L227

There are other methods that let you query/modify it in saner ways. see the methods starting here: https://github.com/GregTechCE/GregTech/blob/d9e7ed4570b990ed389a6a96589636ced78edd34/src/main/java/gregtech/api/unification/material/type/Material.java#L238

warjort avatar Jul 29 '21 22:07 warjort

https://github.com/GregTechCE/GregTech/blob/d9e7ed4570b990ed389a6a96589636ced78edd34/src/main/java/gregtech/api/unification/material/type/Material.java#L238-L241 and https://github.com/GregTechCE/GregTech/blob/d9e7ed4570b990ed389a6a96589636ced78edd34/src/main/java/gregtech/api/unification/material/type/Material.java#L257-L261 can replace @ZenProperty("generationFlagsRaw") .

Alpaca2s avatar Jul 30 '21 06:07 Alpaca2s