Skip to content

MohistMC/CodeRule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Package name rules

  • com.mohistmc.[Project Name].
    com.mohistmc.mohist.*
    com.mohistmc.banner.*  
    

Import rules

  • Import the complete class path and prohibit use
    import com.mohistmc.mohist.* ×
    import com.mohistmc.mohist.Main √
    

Patch project

  • Reduce the use of Java lambda, which will break the recognition of Mixins
    For example: @Redirect(method = { "lambda$reloadResources$29" },
    if you add a lambda, it will cause the quantity to change, so that $29 is not correctly identified

      Wrong usage
      List<String> names = Arrays.asList("Alice", "Bob", "Charlie");
      Collections.sort(names, (a, b) -> a.length() - b.length());
    
      Correct usage
      List<String> names = Arrays.asList("Alice", "Bob", "Charlie");
      Collections.sort(names, new Comparator<String>() {
          @Override
          public int compare(String a, String b) {
              return a.length() - b.length();
          }
      });
    

    Paper Patch

    • Only implement plugin API, try to avoid MC optimization patches, you can use optimization mods instead, we need to ensure the compatibility of mods, because Papper is vanilla and does not consider mods

About

Some code behavior norms applicable to MohistMC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published