GregTechCE / GregTech

GregTech rewrite for modern versions of Minecraft
GNU Lesser General Public License v3.0
269 stars 150 forks source link

A mistake about using @ZenProperty #1700

Open Alpaca2s opened 3 years ago

Alpaca2s commented 3 years ago

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.

warjort commented 3 years ago

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

Alpaca2s commented 3 years ago

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") .