SkyblockerMod / Skyblocker

Hypixel Skyblock fabric Mod for latest minecraft version
https://hysky.de
GNU Lesser General Public License v3.0
174 stars 87 forks source link

Add unbreakable carpet highlighter #1034

Open Emirlol opened 4 weeks ago

Emirlol commented 4 weeks ago

Renders a colored box around nearby carpets within mithril ore veins in dwarven mines. image It can be toggled on and off, and the color is configurable. image Uses up about 0.30% of tick time for scanning & rendering while in dwarven mines. Didn't test outside but it should be much less, probably not even worth mentioning as it's just a boolean if check on each tick. image

Emirlol commented 1 week ago

It seems that this pr just continually adds to the list of carpets without checking if it was already in the list? The list should be changed to a set, (AVLTreeSet should be better in this case as this is look-up intensive.) Also set contains should be checked before calling checkForCarpet.

CARPET_LOCATIONS is an ObjectArraySet, so it already does the contains check within its add method. As for using an AVLTreeSet, sure, that's easy to change.

kevinthegreat1 commented 1 week ago

CARPET_LOCATIONS is an ObjectArraySet, so it already does the contains check within its add method. As for using an AVLTreeSet, sure, that's easy to change.

Oh, sorry. I read it as ObjectArrayList for some reason. Then my comment about AVLTreeSet is not needed.

Emirlol commented 1 week ago

Oh, sorry. I read it as ObjectArrayList for some reason. Then my comment about AVLTreeSet is not needed.

Oops too late xd

kevinthegreat1 commented 1 week ago

Oops too late xd

On the bright side, we can handle millions of carpets now...

Emirlol commented 1 week ago

I'm not sure how well an AVLTreeSet will handle iteration over millions of carpets per frame, though.

And I just noticed that light gray carpet is used for sneaky lighting in various places outside of tungsten ore veins. Idk what we should do for these false positives. It probably doesn't matter since they are indeed unbreakable carpets, but still.