Could this code be optimized/simplified?

Started by urielito3010 on

Topic category: Help with modding (Java Edition)

Last seen on 17:02, 26. Mar 2024
Joined Dec 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Could this code be optimized/simplified?

Those are the code lines that I have for my modifier system, but it's only 2/5 of the code and I think that it having already 6544 lines is a lot, is there anyway to simplify it? 

https://pastebin.com/22eyqmA5

It can indeed be optimized,…
Mon, 06/29/2020 - 10:02

It can indeed be optimized, but I would recommend doing it from scratch manually.

Code generator needs to adapt to the fact Java is hard typed language but blocks are not, that there are many more checks required to ensure reliability in all block combinations so there is much longer code needed to account for all situations where ceratin blocks might be used.

Optimizing such code to the extent of hand-written code is simply not possible with the current advancements in the code generation technologies possible.

You could split the procedure into smaller parts too.

In many cases, the whole blocks structure can be optimized too and the code will be shorter too.