コード例 #1
0
ファイル: Mob.cs プロジェクト: Nsyrgame7/MiNET
		public virtual void BroadcastArmor()
		{
			McpeMobArmorEquipment armorEquipment = McpeMobArmorEquipment.CreateObject();
			armorEquipment.runtimeEntityId = EntityId;
			armorEquipment.helmet = Helmet;
			armorEquipment.chestplate = Chest;
			armorEquipment.leggings = Leggings;
			armorEquipment.boots = Boots;
			Level.RelayBroadcast(armorEquipment);
		}
コード例 #2
0
        private void SendArmorForPlayer(Player player)
        {
            var armorEquipment = McpeMobArmorEquipment.CreateObject();

            armorEquipment.runtimeEntityId = player.EntityId;
            armorEquipment.helmet          = player.Inventory.Helmet;
            armorEquipment.chestplate      = player.Inventory.Chest;
            armorEquipment.leggings        = player.Inventory.Leggings;
            armorEquipment.boots           = player.Inventory.Boots;
            player.Level.RelayBroadcast(armorEquipment);
        }
コード例 #3
0
        protected virtual void SendArmor()
        {
            McpeMobArmorEquipment armorEquipment = McpeMobArmorEquipment.CreateObject();

            armorEquipment.runtimeEntityId = EntityId;
            armorEquipment.helmet          = ItemFactory.GetItem(Helmet);
            armorEquipment.chestplate      = ItemFactory.GetItem(Chest);
            armorEquipment.leggings        = ItemFactory.GetItem(Leggings);
            armorEquipment.boots           = ItemFactory.GetItem(Boots);
            Level.RelayBroadcast(armorEquipment);
        }
コード例 #4
0
ファイル: PlayerMob.cs プロジェクト: yungtechboy1/MiNET
        public override void SpawnToPlayers(Player[] players)
        {
            {
                var fake = new Player(null, null)
                {
                    ClientUuid  = ClientUuid,
                    EntityId    = EntityId,
                    NameTag     = NameTag,
                    DisplayName = NameTag,
                    Username    = NameTag,
                    Skin        = Skin,
                    PlayerInfo  = new PlayerInfo
                    {
                        DeviceOS       = 7,
                        PlatformChatId = NameTag,
                    }
                };

                var playerList = McpePlayerList.CreateObject();
                playerList.records = new PlayerAddRecords {
                    fake
                };
                Level.RelayBroadcast(players, Level.CreateMcpeBatch(playerList.Encode()));
                playerList.records = null;
                playerList.PutPool();
            }

            {
                var message = McpeAddPlayer.CreateObject();
                message.uuid            = ClientUuid;
                message.username        = NameTag;
                message.entityIdSelf    = EntityId;
                message.runtimeEntityId = EntityId;
                message.x        = KnownPosition.X;
                message.y        = KnownPosition.Y;
                message.z        = KnownPosition.Z;
                message.yaw      = KnownPosition.Yaw;
                message.headYaw  = KnownPosition.HeadYaw;
                message.pitch    = KnownPosition.Pitch;
                message.metadata = GetMetadata();
                message.userId   = -1;
                Level.RelayBroadcast(players, message);
            }

            {
                var message = McpeMobEquipment.CreateObject();
                message.runtimeEntityId = EntityId;
                message.item            = ItemInHand;
                message.slot            = 0;
                Level.RelayBroadcast(players, message);
            }
            {
                var armorEquipment = McpeMobArmorEquipment.CreateObject();
                armorEquipment.runtimeEntityId = EntityId;
                armorEquipment.helmet          = Helmet;
                armorEquipment.chestplate      = Chest;
                armorEquipment.leggings        = Leggings;
                armorEquipment.boots           = Boots;
                Level.RelayBroadcast(players, armorEquipment);
            }

            {
                var fake = new Player(null, null)
                {
                    ClientUuid = ClientUuid,
                    EntityId   = EntityId,
                    NameTag    = NameTag,
                    Skin       = Skin
                };

                var playerList = McpePlayerList.CreateObject();
                playerList.records = new PlayerRemoveRecords {
                    fake
                };
                Level.RelayBroadcast(players, Level.CreateMcpeBatch(playerList.Encode()));
                playerList.records = null;
                playerList.PutPool();
            }

            {
                var setEntityData = McpeSetEntityData.CreateObject();
                setEntityData.runtimeEntityId = EntityId;
                setEntityData.metadata        = GetMetadata();
                Level?.RelayBroadcast(players, setEntityData);
            }
        }
コード例 #5
0
        public override void SpawnToPlayers(Player[] players)
        {
            {
                Player fake = new Player(null, null)
                {
                    ClientUuid = Uuid,
                    EntityId   = EntityId,
                    NameTag    = NameTag,
                    Skin       = Skin
                };

                McpePlayerList playerList = McpePlayerList.CreateObject();
                playerList.records = new PlayerAddRecords {
                    fake
                };
                Level.RelayBroadcast(players, Level.CreateMcpeBatch(playerList.Encode()));
                playerList.records = null;
                playerList.PutPool();
            }

            {
                McpeAddPlayer message = McpeAddPlayer.CreateObject();
                message.uuid            = Uuid;
                message.username        = NameTag;
                message.entityIdSelf    = EntityId;
                message.runtimeEntityId = EntityId;
                message.x        = KnownPosition.X;
                message.y        = KnownPosition.Y;
                message.z        = KnownPosition.Z;
                message.yaw      = KnownPosition.Yaw;
                message.headYaw  = KnownPosition.HeadYaw;
                message.pitch    = KnownPosition.Pitch;
                message.metadata = GetMetadata();
                Level.RelayBroadcast(players, message);
            }
            {
                McpeMobEquipment message = McpeMobEquipment.CreateObject();
                message.runtimeEntityId = EntityId;
                message.item            = ItemInHand;
                message.slot            = 0;
                Level.RelayBroadcast(players, message);
            }
            {
                McpeMobArmorEquipment armorEquipment = McpeMobArmorEquipment.CreateObject();
                armorEquipment.runtimeEntityId = EntityId;
                armorEquipment.helmet          = ItemFactory.GetItem(Helmet);
                armorEquipment.chestplate      = ItemFactory.GetItem(Chest);
                armorEquipment.leggings        = ItemFactory.GetItem(Leggings);
                armorEquipment.boots           = ItemFactory.GetItem(Boots);
                Level.RelayBroadcast(players, armorEquipment);
            }

            //{
            //	Player fake = new Player(null, null)
            //	{
            //		ClientUuid = Uuid,
            //		EntityId = EntityId,
            //		NameTag = NameTag,
            //		Skin = Skin
            //	};

            //	McpePlayerList playerList = McpePlayerList.CreateObject();
            //	playerList.records = new PlayerRemoveRecords {fake};
            //	Level.RelayBroadcast(players, Level.CreateMcpeBatch(playerList.Encode()));
            //	playerList.records = null;
            //	playerList.PutPool();
            //}

            {
                McpeSetEntityData setEntityData = McpeSetEntityData.CreateObject();
                setEntityData.runtimeEntityId = EntityId;
                setEntityData.metadata        = GetMetadata();
                Level?.RelayBroadcast(players, setEntityData);
            }
        }