Fix Vehicle entering unloaded chunk to prevent game kicking player off vehicle on MC1165 - MC1201#2048
Conversation
…er unloaded chunk or not
|
Additional comment : This base code does fix the issue but the method that get block sample to throw into minecraft's chunk checking function just ditch it self beyond build height so if there suggestion or better method for this i also can try it . -# This code was wrote all by my self with some research of basic Minecraft function through documentation that so hard to find so i know everything i wrote. |
|
@DonBruce64 So we have an issue here, both me and nax have a running attempt at fixing this issue. Max system works as described above just that the "dealbreaker" is the system no longer working above build height, which is unfortunately also the height most players will fly above of rather than below. Do you have any insight how we can get the best of both worlds? |
|
You forgot the part that your just make plane fall like stone when it hit unloaded chunk and not work with heavy mod setup. |
|
wait i think i see what the issue i will re commit it |
Edit the part where it call the SF modifier.
Changed part where it call the function
Fine tune the code a little bit
|
Update Test results
Note : the latest commit i made completely work just fine above build height as while testing i fly at Y : 702 at 45+ Blks/s |
|
@DonBruce64 I tested so far, it doesn't seem to quite function for me but it could be my computer being majorly confused. It definitely worked for Nax though... |
i added this section just to make it only check by server side as i afraid of false detection or desync but it not work on SP at all so i comment it out
|
I committed other change which just comment out section that make the function only work on server side. |
|
Update on test result |
|
@Naxgeneral @SnailPerson so looking at both your codes, I can see what the idea is. Slow down the vehicle when it gets near unloaded chunks. However, you're modifying the speed factor only in some parts of the code. And also you're doing this modification on the client and server, which has the problem of causing de-syncs if the client takes longer to load a chunk than the server, and thus gets knecapped sooner. What I would potentially try is the following: With this, the vehicle should simply halt processing on the server once it gets to an unloaded chunk. The client could run this code too, and since both don't adjust speed factor, the internal code will act as if it just didn't get a tick update and won't know anything is outside the ordinary. This also ensures that syncing operations don't get mal-adjusted, as they are designed to dynamically rubber-band assuming the server and client have the same math applied. And this is the key: if you change the speed factor on the server for 2 ticks, but the client for 8, then they are going to get out of sync due to them having different physics calculations. But if you block the server for 2 ticks and the client for 8, that just means the client is "lagging" from the server with different calculations and will "catch-up". In the flip side, it might get "pushed back" by the syncing code. But the root thing here is that you don't dyanmically change the physics maths which are fairly important and need to run at a consistent settings in order to prevent issues. To effect this, you'll probably want to leverage similar logic to the towing vehicles. Having a bit that notes updates are skipped, as you'll need to not only block the vehicle's updates, but ensure that any parts that are on the vehicle also don't process updates. These parts can just check if the vehicle update was blocked, via a function call. So something like this in EntityManager Then in the vehicle Then in the part |
|
ah i see Thank you for pointing it out but thing was if vehicle fully stop update sometime player want to turn around back into loaded chunk is there way to do that with this method if it make vehicle completely stop updating |
|
Well, the thing is the vehicle will only stop updating until the chunk decides to load. So it won't hurt things. Plus, it'll ensure that vehicles that go really fast won't cause undue tick-calculations with physics updates they don't need to perform since they're on the edge of the world. Once the chunks ahead load, the player can turn the vehicle around. Though really they shouldn't be flying as fast as they are on the server in general if they're outpacing chunk loading. |
About
This is a fix that prevent vehicle from entering unloaded chunk.
How it work
Get a block sample by using vehicle's point 3D X,Z position with fixed Y pos being 1. added by vehicle motionApplied * 42 to get position infront of vehicle based on motion.
Then cache it in quarantine zone to check if it loaded or not by using minecraft's internal function method.
While this being checked it set vehicle's speed factor to 0.009 so vehicle is slow enough to wait for chunk to load. while also set timer to check if player turn away from this unloaded chunk or not to prevent vehicle always travel at 0.009 SF while turn away from unloaded area.
If the chunk in the quarantine zone is loaded vehicle will be let go and using its own respective speed factor and get new block sample.
Advantage :
This method will not force limit vehicle actual movement speed which will not cause some plane that require high speed to stall.
Disadvantage :
This probably caused by minecraft basic function stop working when entity left build height cause it seem like the system just not work at all beyond build heightThis should be fixed in latest commitMy own Test result :
Client :
I tested this my self on my mod pack setup that somehow make world generate 1 chunk per 2 business day and it work as intended
Server :
as well as in server environment i usually have bad connection between a server (800ms ping) which usually make server not realize my actual position and not load chunk in the path and make game kick me out from plane but with this fix i able to fly even with bad internet connection or during high server load.
foot note :
I have to test this all my self as i posted beta and 9999 people who crying over this issue just vanished like they vaporized and not even come to test the fix.