sisby-folk / inventory-tabs

A minecraft mod that allows swapping to other in-world screens (blocks, entities, etc) via tabs. A fourth-generation rewrite of CakeWhip's InventoryTabs.
https://modrinth.com/mod/inventory-tabs
GNU Lesser General Public License v3.0
6 stars 3 forks source link

Fix raycast false negatives #49

Closed CCheukKa closed 2 months ago

CCheukKa commented 2 months ago

Fixes #40. This fix should drastically reduce the number of false negatives by exploring random offset points over a few ticks for the raycast. Theoretically, it should also give a slight performance boost since the random raycasts are only done when necessary (the old offset point becomes obstructed).

A slight caveat is that the time necessary to register the blocks is proportional to the exposed screenspace surface area. Empirically, this is <20 ticks for the worst cases. Scenarios that the original method could have taken care of incur no extra time penalties.

sisby-folk commented 2 months ago

I am very glad to hear someone wanted to tackle this problem - I'll give it a look!

sisby-folk commented 2 months ago

Tested it out - logic makes a lot of sense! prevents needing to do a bunch of raycasts on blocks we expect to be valid as well, which is great.

Thanks!

CCheukKa commented 2 months ago

Happy to contribute to a mod that I love :)