VazkiiMods / Psi

Spellcrafting mod for Minecraft based around Vector math and stack-based processing
http://psi.vazkii.net
314 stars 89 forks source link

[REQUEST/BUG?] Sort the Selector Lists in Order of Ascending Entity Creation Number #789

Closed cambates99 closed 10 months ago

cambates99 commented 1 year ago

Version Information

Forge version: 40.2.1 Psi version: 2.0.0

Further Information

The issue I'm running into is that the selector lists will index the entities inside the targeted radius pseudo-randomly. This makes it very challenging to use the selector indexed element to distinguish between old/new entities populating the list.

Similar Ticket I read through ticket #664 and think this issue is entirely different. This has nothing to do with concatenating lists, so I thought I'd hear your thoughts on the proposed change.

Proposed Change I've read through some of the list population code under public abstract class PieceSelectorNearby extends PieceSelector and propose you add under Line 71 something close to list.sort(Comparator.comparingInt(Entity::getNumber).

I'm unsure how you're storing the entities generation number (could be an int or string), but that number is universal & unique for every entity created. I'm talking about the number seen here: https://imgur.com/4UzWvyz

Kamefrede commented 10 months ago

Changed the internal list ordering algorithm to use the entity's id. Let's see how this pans out.

cambates99 commented 10 months ago

Awesome! I'm gonna mess around with it here in a few days. I came up with a really interesting spell and hopefully I can get it working now. :)