sachingorkar102 / Tweakin

29 stars 17 forks source link

[FastLeafDecayTweak] Remove unnecessary async feature and optimize the code #36

Closed sandtechnology closed 2 years ago

sandtechnology commented 2 years ago

Changes:

  1. Remove unnecessary async feature, basically all operations is done on the main thread, so it's no needed and may run out of thread resources. (I meet the following errors and server crashed by this repeatedly)
    java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
  2. Remove unnecessary fastDecayEvents and replace with more efficient instanceof checking.
  3. Renamed misleading method name (getNearbyBlock -> getNearbyLeaves)
  4. Merge if statements and remove duplicated checking statements
  5. Use ThreadLocalRandom instead of creating a new Random instance every time.
sachingorkar102 commented 2 years ago

Appreciate the pr But can you also provide me the updated jar with a version bump? As i am not in the state to compile it

sandtechnology commented 2 years ago

I have test it and passed in my 1.18.1 server, and look like I can't send the jar directly, I have put that to mega: https://mega.nz/file/Atxz2aCD#wrDIF7lbJyuOQw6pDbNNzorfg3TVbRK92ZTl8nsBDvw Also a zip for it is there: Tweakin-3.8.6.jar.zip