Entity nulling rework - #1299
Open
Robotgiggle wants to merge 13 commits into
Open
Robotgiggle wants to merge 13 commits into
Robotgiggle wants to merge 13 commits into
Conversation
s5bug
approved these changes
Sep 13, 2026
IridescentVoid
requested changes
Sep 13, 2026
IridescentVoid
left a comment
Contributor
There was a problem hiding this comment.
A few changes/blockers for merging:
- In discord: design discussion around intuitiveness and other points raised
- Likely performance issues in
EntityIota.isPlayer. It would be best if we can run real benchmarks on whether this is a problem, including when the backing store is a hard disk rather than a SSD. Hex Casting should be playable even for players on older hardware. - Incorrect mishaps raised by some
ActionUtilshelper methods (that were not updated by the pr, but probably should have been) - Discussion: should cleric impeti allow binding to offline players, since references are always considered valid now? After all, binding impeti does not require ambit. (
BlockRedstoneImpetus.useItemOn, around L73)
s5bug
approved these changes
Sep 13, 2026
Comment on lines
+97
to
+113
| // This finds anyone who has ever joined the server by reading the UUIDs from the playerdata folder | ||
| // We can't just use GameProfileCache because it only stores 1000 UUIDs and only keeps them for 30 days | ||
| public static void initPlayerUUIDs(MinecraftServer server) { | ||
| var playerDataDir = server.getWorldPath(LevelResource.PLAYER_DATA_DIR).toFile(); | ||
| String[] uuidStrings = playerDataDir.list(); | ||
| if (uuidStrings == null) return; | ||
| for (String string : uuidStrings) { | ||
| if (string.endsWith(".dat")) { | ||
| UUID playerId = UUID.fromString(string.substring(0, string.length() - 4)); | ||
| playerUUIDs.add(playerId); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public static void addPlayerUUID(UUID newUUID) { | ||
| playerUUIDs.add(newUUID); | ||
| } |
Contributor
There was a problem hiding this comment.
I don't like these being public...
Comment on lines
136
to
+149
| @@ -143,6 +145,8 @@ object FabricHexInitializer : ModInitializer { | |||
| ServerTickEvents.END_WORLD_TICK.register(OpFlight::tickAllPlayers) | |||
| ServerTickEvents.END_WORLD_TICK.register(OpAltiora::checkAllPlayers) | |||
|
|
|||
| ServerPlayerEvents.JOIN.register { player -> EntityIota.addPlayerUUID(player.uuid) } | |||
|
|
|||
Contributor
There was a problem hiding this comment.
...but I don't see another way, considering how event handlers are registered :(
s5bug
suggested changes
Sep 14, 2026
s5bug
reviewed
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1227, removes the behavior of entity iotas becoming null when their referenced entity ceases to exist, and replaces it with an entity-doesn't-exist mishap thrown when you try to use an iota pointing to something nonexistent. To check whether the entity currently exists, you can use Augur's Purification on the iota.
Entity iotas nulling themselves is the only instance of iotas changing on their own without player input, so it was always a little bit unintuitive. However, naively removing that behavior would make it possible to save truenames of offline players. Previously, that problem was handled via an added
isPlayerboolean on the iota, but this comes with its own problems (notably, making the iota mutable since setting the value on preexisting iotas needed to be done invalidate()while the player in question was online).This PR implements a different solution that does not require any new data, codec shenanigans, or mutability. When the server starts up, it runs through its playerdata folder and stores all the UUIDs it finds into a set of "known players". When a new player joins, their UUID is also added to the set. Then, when checking playerness of an iota whose entity does not currently exist, it just compares the UUID to the set of known players. This does not account for players who have never joined the server before, but there's no way to get an entity iota for such a player without using commands, and with commands you can spawn in as many saved truenames as you want anyway.