Archived
0

apply upgraded Location & EntityLocation

This commit is contained in:
2018-08-08 13:19:45 +03:00
parent 83de8629e1
commit a0f91730d0
18 changed files with 69 additions and 77 deletions

View File

@@ -10,7 +10,6 @@ import mc.core.network.proto_1_12_2.State;
import mc.core.network.proto_1_12_2.TeleportManager;
import mc.core.network.proto_1_12_2.netty.wrappers.WrapperNetChannel;
import mc.core.network.proto_1_12_2.packets.*;
import mc.core.player.Look;
import mc.core.player.Player;
import mc.core.player.PlayerManager;
import mc.core.player.PlayerMode;
@@ -48,8 +47,7 @@ public class LoginHandler extends AbstractStateHandler implements LoginStateHand
Player player = playerManager.getPlayer(packet.getPlayerName())
.orElseGet(() -> playerManager.createPlayer(
packet.getPlayerName(),
world.getSpawn().getLocation(),
new Look(0f, 0f)));
world.getSpawn()));
channel.writeAndFlush(new LoginSuccessPacket(
player.getUUID(),
@@ -68,7 +66,7 @@ public class LoginHandler extends AbstractStateHandler implements LoginStateHand
// Spawn Position
SpawnPositionPacket pkt2 = new SpawnPositionPacket();
pkt2.setLocation(world.getSpawn().getLocation());
pkt2.setLocation(world.getSpawn());
channel.write(pkt2);
// Player Abilities
@@ -91,7 +89,6 @@ public class LoginHandler extends AbstractStateHandler implements LoginStateHand
// Player Position And Look
PlayerPositionAndLookPacket pkt4 = new PlayerPositionAndLookPacket();
pkt4.setLocation(player.getLocation());
pkt4.setLook(player.getLook());
pkt4.setTeleportId(TeleportManager.getInstance().append(player, player.getLocation()));
channel.writeAndFlush(pkt4);

View File

@@ -52,8 +52,8 @@ public class PlayHandler extends AbstractStateHandler implements PlayStateHandle
@Handler
public void onPositionAndLook(Channel channel, PlayerPositionAndLookPacket packet) {
Player player = channel.attr(ATTR_PLAYER).get();
player.getLocation().set(packet.getLocation());
player.getLook().set(packet.getLook());
player.getLocation().setXYZ(packet.getLocation());
player.getLocation().setYawPitch(packet.getLocation());
}
@Handler