DragonetMC / DragonProxy

🐲 A proxy to allow Minecraft: Bedrock clients to connect to Minecraft: Java Edition servers.
https://invite.gg/DragonetMC
GNU General Public License v3.0
990 stars 134 forks source link

Attempted Fix at random bedrock crashes #535

Closed james090500 closed 4 years ago

james090500 commented 4 years ago

When a sendFakeGameStart was sent the unique entity ID of the player was hard coded as 1. This player is obviously the bedrock player so has to stay in the cache.

However, when joining the java server, entities are sent to dragonproxy with the entity ID. For example in CapeCraft's hub a floating item has an entityID of 1. Now when you walk to far away from this entity a ServerEntityDestroyPacket is sent for entityID 1 (The Item) but as DP has seemed to merge the player and item into one entry, the player is removed from the cache causing bedrock to crash.

As Entity ID's should never be negative, I have set the player entity ID to Integer.MIN_VALUE. Theoretically this could fix many other crashes players have due to entities.

lukeeey commented 4 years ago

I don’t see how this is an issue. If you look in EntityCache, unless I changed it, the proxy id counter begins at 2, since 1 in for the session

james090500 commented 4 years ago

That's the proxy id. I am talking about the remote entity ID. As in the ID the java servers sends to the client.

james090500 commented 4 years ago

For example, when a new entity is created. The entity ID is passed from the packet.

see below:

https://github.com/DragonetMC/DragonProxy/blob/rewrite/proxy/src/main/java/org/dragonet/proxy/network/translator/java/entity/spawn/PCSpawnGlobalEntityTranslator.java#L49

There for, by manually setting the player entityID to 1, any other entity ID with 1 will cause a clash

lukeeey commented 4 years ago

The java id doesnt matter as it is mapped to a proxy id when the entity is created

james090500 commented 4 years ago

Fixed in 6428ce2