Adr-hyng / Anglers-Desire

A Minecraft Bedrock Addon that adds immersion to vanilla fishing feat. realistic reeling just like the fishing minigames of other popular comfort games such Stardew Valley, Animal Crossing, and Harvest Moon Series.
0 stars 0 forks source link

Refactor / Optimization insights #2

Open Adr-hyng opened 1 month ago

Adr-hyng commented 1 month ago

Instead of using isValid() to many custom entity / item / block instances that has isValid() just created a getter and setter if it's valid or not, so you just call it like if(fisher.source), instead of changing all the code with if(fisher.source || fisher.source?.isValid()). As this might can also reduce the potential try-catch blocks. Since it's ugly.

Adr-hyng commented 1 month ago

Make clientConfiguration be class instead of an object (objects are weird, you need to use JSON.parse(JSON.stringify(...))) to just deep clone a new object.

Adr-hyng commented 1 month ago

Use isSolid for block, when it's stable.

Adr-hyng commented 1 week ago