Skip to content

Conversation

@Ingrim4
Copy link
Member

@Ingrim4 Ingrim4 commented Mar 31, 2025

Description

Add a async packet listener/injector that doesn't reorder packets.

Related Issue

closes #412

Motivation and Context

How Has This Been Tested?

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

}

PacketContainer packetContainer = new PacketContainer(packetType, packet);
ChunkStruct struct = new ChunkStruct(packetContainer, this.player.getWorld());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont like that we still get world in async. Maybe you can use sync ProtocolLib listener just to map System.identityHashCode(packet.getHandle()) -> player.getWorld() and here try to get it from map, if null fallback to player.getWorld().

Also i think sync listener could be used for starting obfuscate proccess for chunk as soon as possible, so we have minimal packet delay(Mostly is starting getting neighboring chunks as soon as posible (i think it is main source for packet delay)). At least on modern versions if you try to get chunk async while being on main thread it firstly check if chunk is already loaded and if loaded then it completes future immediately so this behaviour can be used to reduce packet delay.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly a good idea would like to implement this maybe at a later stage not sure yet, I have to think about a possible implementation a bit.

}

public void uninject() {
if (!this.channel.eventLoop().inEventLoop()) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is uninject really should be done in event loop always? On plugin disable i think it should not switch contexts.
I think nobody is reloading orebfuscator via PlugMan, but for developing purposes it can be done and there is a really low chance that on plugin reloading it may fail to inject because old handler is still present on pipeline.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it would hurt to remove the event-loop context switch so I will do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Async Chunk Processing & World switching issues

3 participants