Обработка PlayerPositionAndLook
This commit is contained in:
@@ -7,6 +7,7 @@ package mc.core.network.proto_1_12_2.packets;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import mc.core.Location;
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.NetStream;
|
||||
@@ -17,6 +18,7 @@ import mc.core.player.Look;
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class PlayerPositionAndLookPacket implements SCPacket, CSPacket {
|
||||
private Location location;
|
||||
private Look look;
|
||||
|
||||
@@ -7,6 +7,7 @@ package mc.core.network.proto_1_12_2.netty.handlers;
|
||||
import io.netty.channel.Channel;
|
||||
import mc.core.network.proto_1_12_2.TeleportManager;
|
||||
import mc.core.network.proto_1_12_2.packets.ClientSettingsPacket;
|
||||
import mc.core.network.proto_1_12_2.packets.PlayerPositionAndLookPacket;
|
||||
import mc.core.network.proto_1_12_2.packets.TeleportConfirmPacket;
|
||||
import mc.core.player.Player;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -41,4 +42,11 @@ public class PlayHandler extends AbstractStateHandler implements PlayStateHandle
|
||||
public void onTeleportConfirm(Channel channel, TeleportConfirmPacket packet) {
|
||||
this.teleport.apply(packet.getTeleportId());
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user