Outurnate / WarpBook

A small mod for minecraft
GNU General Public License v3.0
9 stars 10 forks source link

Update Proxy.java - When teleporting into unloaded chunk #6

Closed TheTemportalist closed 9 years ago

TheTemportalist commented 9 years ago

Occasionally, when teleporting about, I will teleport into an unloaded chunk (or what I assume is an unloaded chunk) and I must re log into the world to loaded it up. What makes me think this is an unloaded chunk, is that when I teleport, nothing is loaded around me. All I can see is the horizon, and I am unable to move (moving the mouse puts the screen back at the rotation it was before moving)

This PR SHOULD fix that issue. Hopefully it is valid for your liking. :)

Changelog: Makes sure the the destination chunk is loaded before teleporting

Outurnate commented 9 years ago

While this probably works, it doesn't address the underlying issue. The teleport is currently handled server-side only. Almost all the information is available on the client side, aside from player positions.

I'm not totally decided on what I'm gonna do... Will probably merge this and use it only for the player pages

----- Reply message ----- From: "TheCountryGamer" notifications@github.com To: "panicnot42/WarpBook" WarpBook@noreply.github.com Subject: [WarpBook] Update Proxy.java - When teleporting into unloaded chunk (#6) Date: Mon, Sep 15, 2014 13:05 Occasionally, when teleporting about, I will teleport into an unloaded chunk (or what I assume is an unloaded chunk) and I must re log into the world to loaded it up.

What makes me think this is an unloaded chunk, is that when I teleport, nothing is loaded around me. All I can see is the horizon, and I am unable to move (moving the mouse puts the screen back at the rotation it was before moving)

This PR SHOULD fix that issue. Hopefully it is valid for your liking. :)

Changelog:

Makes sure the the destination chunk is loaded before teleporting

You can merge this Pull Request by running git pull https://github.com/TheCountryGamer/WarpBook 1.7.10 Or view, comment on, or merge it at: https://github.com/panicnot42/WarpBook/pull/6

Commit Summary

Update Proxy.java

File Changes

M src/main/java/com/panicnot42/warpbook/Proxy.java (7)

Patch Links:

https://github.com/panicnot42/WarpBook/pull/6.patch https://github.com/panicnot42/WarpBook/pull/6.diff

— Reply to this email directly or view it on GitHub.

TheTemportalist commented 9 years ago

I might ask you to look at the code at my lib. It can be called from either side, and will teleport the player accordingly. (Might still need tweaking here an there, but it works.) (https://github.com/TheCountryGamer/CG-Origin/blob/master/src/main/scala/com/countrygamer/cgo/common/lib/util/UtilVector.java#L106) For the book, since you teleport on button press, I might also suggest sending the packet to the server first, teleport on the server, then send the same packet to the client right away (from the book GUI), cause the client to load everything up as well. This way, you make sure the player is teleported on both sides. Syncing will automatically occur internally post teleportation.

Outurnate commented 9 years ago

That's about what it does now.

GUI triggers client side warp, and sends server a packet to replicate the action. However, due to player positon only being available on the server side, as a temporary fix, the warp is disabled on the client side. This isn't a problem for 90% of users, but, it is more often a problem in SMP

----- Reply message ----- From: "TheCountryGamer" notifications@github.com To: "panicnot42/WarpBook" WarpBook@noreply.github.com Cc: "panicnot42" joe.robotics@hotmail.com Subject: [WarpBook] Update Proxy.java - When teleporting into unloaded chunk (#6) Date: Tue, Sep 16, 2014 09:08 I might ask you to look at the code at my lib. It can be called from either side, and will teleport the player accordingly. (Might still need tweaking here an there, but it works.) (https://github.com/TheCountryGamer/CG-Origin/blob/master/src/main/scala/com/countrygamer/cgo/common/lib/util/UtilVector.java#L106)

For the book, since you teleport on button press, I might also suggest sending the packet to the server first, teleport on the server, then send the same packet to the client right away (from the book GUI), cause the client to load everything up as well. This way, you make sure the player is teleported on both sides. Syncing will automatically occur internally post teleportation.

— Reply to this email directly or view it on GitHub.

TheTemportalist commented 9 years ago

Why can you not just send the same packet? We are you not able to SET the position on both server AND client?

Outurnate commented 9 years ago

Because sending the same packet is redundant. That would involve sending the packet from the client back to the client. The problem is non-existent for all pages but the player page. This is because I have not yet developed a nice way of retrieving player location on the client side. So as a 'band-aid' fix, I simply disabled client side teleporting.

----- Reply message ----- From: "TheCountryGamer" notifications@github.com To: "panicnot42/WarpBook" WarpBook@noreply.github.com Cc: "panicnot42" joe.robotics@hotmail.com Subject: [WarpBook] Update Proxy.java - When teleporting into unloaded chunk (#6) Date: Tue, Sep 16, 2014 12:51 Why can you not just send the same packet? We are you not able to SET the position on both server AND client?

— Reply to this email directly or view it on GitHub.

Outurnate commented 9 years ago

Only if it's loaded into view/in the current dimension. The server won't send entities outside view range/dimension

----- Reply message ----- From: "TheCountryGamer" notifications@github.com To: "panicnot42/WarpBook" WarpBook@noreply.github.com Cc: "panicnot42" joe.robotics@hotmail.com Subject: [WarpBook] Update Proxy.java - When teleporting into unloaded chunk (#6) Date: Tue, Sep 16, 2014 12:49 Who says the player position is only avail bile on the server? Can you not get pos X Y Z from any entity object?

— Reply to this email directly or view it on GitHub.

Outurnate commented 9 years ago

I'm gonna merge this - just as an added measure