• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ServerEntityHeadLookPacket类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket的典型用法代码示例。如果您正苦于以下问题:Java ServerEntityHeadLookPacket类的具体用法?Java ServerEntityHeadLookPacket怎么用?Java ServerEntityHeadLookPacket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ServerEntityHeadLookPacket类属于org.spacehq.mc.protocol.packet.ingame.server.entity包,在下文中一共展示了ServerEntityHeadLookPacket类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onClientPlayerPosition

点赞 3

import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket; //导入依赖的package包/类
@PacketHandler
public void onClientPlayerPosition(PCSession session, ClientPlayerPositionPacket packet) {
    final Entity entity = session.getEntity();
    final double deltaX = packet.getX() - entity.x;
    final double deltaY = packet.getY() - entity.y;
    final double deltaZ = packet.getZ() - entity.z;

    entity.x = packet.getX();
    entity.y = packet.getY();
    entity.z = packet.getZ();
    entity.yaw = packet.getYaw();
    entity.headYaw = entity.yaw;
    entity.pitch = packet.getPitch();

    SpongeGame.instance.getServer().getNetwork().getSessions().stream().filter(otherSession -> otherSession.isConnected()
            && ((PCSession) otherSession).getPacketProtocol().getProtocolPhase() == ProtocolPhase.INGAME).forEach(otherSession -> {
                if (otherSession != session) {
                    otherSession.send(new ServerEntityPositionRotationPacket(entity.id, deltaX, deltaY, deltaZ, GenericMath.floor(packet.getYaw()
                            * 256.0F / 360.0F), GenericMath.floor(packet.getPitch() * 256.0F / 360.0F), false));

                    otherSession.send(new ServerEntityHeadLookPacket(entity.id, GenericMath.floor(entity.headYaw * 256.0F / 360.0F)));
                }
            }
    );
}
 

开发者ID:InspireNXE,
项目名称:Pulse,
代码行数:26,
代码来源:IngameHandlers.java

示例2: onClientPlayerRotation

点赞 3

import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket; //导入依赖的package包/类
@PacketHandler
public void onClientPlayerRotation(PCSession session, ClientPlayerRotationPacket packet) {
    final Entity entity = session.getEntity();
    entity.yaw = packet.getYaw();
    entity.headYaw = entity.yaw;
    entity.pitch = packet.getPitch();

    SpongeGame.instance.getServer().getNetwork().getSessions().stream().filter(otherSession -> otherSession.isConnected()
            && ((PCSession) otherSession).getPacketProtocol().getProtocolPhase() == ProtocolPhase.INGAME).forEach(otherSession -> {
                if (otherSession != session) {
                    otherSession.send(new ServerEntityRotationPacket(entity.id, GenericMath.floor(packet.getYaw() * 256.0F / 360.0F),
                            GenericMath.floor(packet.getPitch() * 256.0F / 360.0F), false));

                    otherSession.send(new ServerEntityHeadLookPacket(entity.id, GenericMath.floor(entity.headYaw * 256.0F / 360.0F)));
                }
            }
    );
}
 

开发者ID:InspireNXE,
项目名称:Pulse,
代码行数:19,
代码来源:IngameHandlers.java

示例3: onClientPlayerPositionRotation

点赞 3

import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket; //导入依赖的package包/类
@PacketHandler
public void onClientPlayerPositionRotation(PCSession session, ClientPlayerPositionRotationPacket packet) {
    final Entity entity = session.getEntity();

    final double deltaX = packet.getX() - entity.x;
    final double deltaY = packet.getY() - entity.y;
    final double deltaZ = packet.getZ() - entity.z;

    entity.x = packet.getX();
    entity.y = packet.getY();
    entity.z = packet.getZ();
    entity.yaw = packet.getYaw();
    entity.headYaw = entity.yaw;
    entity.pitch = packet.getPitch();

    SpongeGame.instance.getServer().getNetwork().getSessions().stream().filter(otherSession -> otherSession.isConnected()
            && ((PCSession) otherSession).getPacketProtocol().getProtocolPhase() == ProtocolPhase.INGAME).forEach(otherSession -> {
                if (otherSession != session) {
                    otherSession.send(new ServerEntityPositionRotationPacket(entity.id, deltaX, deltaY, deltaZ, GenericMath.floor(packet.getYaw()
                            * 256.0F / 360.0F), GenericMath.floor(packet.getPitch() * 256.0F / 360.0F), false));

                    otherSession.send(new ServerEntityHeadLookPacket(entity.id, GenericMath.floor(entity.headYaw * 256.0F / 360.0F)));
                }
            }
    );
}
 

开发者ID:InspireNXE,
项目名称:Pulse,
代码行数:27,
代码来源:IngameHandlers.java

示例4: setLook

点赞 2

import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket; //导入依赖的package包/类
public void setLook(float yaw) {
	Packet outPacket = new ServerEntityHeadLookPacket(this.getUEID(), yaw);
	if (this.world != null) {
		this.world.broadcastPacket(outPacket, this.x, this.y, this.z, this);
	}
	this.yaw = yaw;
}
 

开发者ID:MineGuard-dev,
项目名称:TestServer_Java,
代码行数:8,
代码来源:ServerEntity.java

示例5: getSpawnPackets

点赞 2

import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket; //导入依赖的package包/类
@Override
public List<Packet> getSpawnPackets() {
    List<Packet> list = new ArrayList<Packet>();
    list.add(new ServerSpawnPlayerPacket(getEntityID(), getUniqueId(), getLocation().getX(), getLocation().getY(), getLocation().getZ(), getLocation().getYaw(), getLocation().getPitch(), 0, ((CyanMetadataMap) getMetadata()).getMetaArray()));
    list.add(new ServerEntityHeadLookPacket(getEntityID(), getLocation().getYaw()));
    // Inventory and etc.

    // TODO
    return list;
}
 

开发者ID:BeYkeRYkt,
项目名称:CyanWool,
代码行数:11,
代码来源:CyanPlayer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)