Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/27/19 in all areas

  1. Also, try and post a fix for the issue
    1 point
  2. No, I also never said anything about a default constructor. You have complete control over creating your items, you just have to do it at the right time. What: Not using an object base class Why: Using an object base class (commonly called BlockBase or ItemBase) is unnecessary and is an anti-pattern. There is already a BlockBase class, it’s the minecraft Block class. Making a class just to have its children inherit default implementations of methods goes against the OOP principle of Composition over Inheritance Consequences: Using a class like this stops you from extending other classes and because lots of minecraft code uses instanceof checks to specially handle logic, you are likely to encounter weird and hard-to-fix bugs. How: Instead of putting all your common logic in 1 class and extending it, extract the logic to utility methods. For example: Instead of calling setRegistryName, setTranslationKey, etc. inside your object base’s constructor, extract it to a helper method and call it on every object when you create it. In this example "setup" calls the above methods. registry.register(setup(new CustomItem(), "custom_item")); You still have access to the registry name, just use the name you pass into the constructor
    1 point
  3. No. Worst idea. Because you never update the values. All of them are air, will always be air, and will never be anything BUT air, as you never assign a value to them except during class construction.
    1 point
  4. It's literally on the top of the page. Click on the message, and read throug that post, if you want to know more, why.
    1 point
×
×
  • Create New...

Important Information

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