Jump to content

[Solved] Question about EnumProperty


OxygenRequired

Recommended Posts

So I've been making blockstate properties with an enum, but ran into trouble with the naming conventions. I followed vanilla code, i.e. all-caps for enum names and then all lowercase for the string values. However, I soon realized that the all-caps naming of the enum was causing the error, so I guess I'm asking as to why... For example, when I was looking through vanilla code to see how they did Enum properties, so in driptsone's case:

public enum DripstoneThickness implements StringRepresentable {
   TIP_MERGE("tip_merge"),
   TIP("tip"),
   FRUSTUM("frustum"),
   MIDDLE("middle"),
   BASE("base");

   private final String name;

   private DripstoneThickness(String p_156018_) {
      this.name = p_156018_;
   }

   public String toString() {
      return this.name;
   }

   public String getSerializedName() {
      return this.name;
   }
}

the enums are named in all capitals, but if I do the same format, it would throw an error. Am I missing something obvious or is there a reason it this? Thanks!

 

[EDIT] I somehow figured it out, please ignore !

Edited by OxygenRequired
Link to comment
Share on other sites

  • OxygenRequired changed the title to [Solved] Question about EnumProperty

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.