Search in sources :

Example 1 with CachedEntity

use of org.dragonet.proxy.network.cache.CachedEntity in project DragonProxy by DragonetMC.

the class PCPlayerPositionRotationPacketTranslator method translate.

@Override
public PEPacket[] translate(UpstreamSession session, ServerPlayerPositionRotationPacket packet) {
    CachedEntity entityPlayer = session.getEntityCache().getClientEntity();
    if (entityPlayer == null) {
    // disconnect (important missing data)
    }
    if (!session.isSpawned()) {
        if (session.getDataCache().get(CacheKey.PACKET_JOIN_GAME_PACKET) == null) {
            session.disconnect(session.getProxy().getLang().get(Lang.MESSAGE_REMOTE_ERROR));
            return null;
        }
        ServerJoinGamePacket restored = (ServerJoinGamePacket) session.getDataCache().remove(CacheKey.PACKET_JOIN_GAME_PACKET);
        if (!session.getProxy().getAuthMode().equalsIgnoreCase("online")) {
            StartGamePacket ret = new StartGamePacket();
            ret.rtid = entityPlayer.proxyEid;
            ret.eid = entityPlayer.proxyEid;
            ret.dimension = entityPlayer.dimention;
            ret.seed = 0;
            ret.generator = 1;
            ret.gamemode = restored.getGameMode() == GameMode.CREATIVE ? 1 : 0;
            ret.spawnPosition = new BlockPosition((int) packet.getX(), (int) packet.getY(), (int) packet.getZ());
            ret.position = new Vector3F((float) packet.getX(), (float) packet.getY() + EntityType.PLAYER.getOffset() + 0.1f, (float) packet.getZ());
            ret.yaw = packet.getYaw();
            ret.pitch = packet.getPitch();
            ret.levelId = "";
            ret.worldName = "World";
            ret.commandsEnabled = true;
            ret.defaultPlayerPermission = 2;
            ret.premiumWorldTemplateId = "";
            ret.difficulty = restored.getDifficulty();
            session.sendPacket(ret, true);
        }
        entityPlayer.absoluteMove(packet.getX(), packet.getY() + entityPlayer.peType.getOffset() + 0.1f, packet.getZ(), packet.getYaw(), packet.getPitch());
        session.getChunkCache().sendOrderedChunks();
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("DragonProxy");
        ClientPluginMessagePacket clientPluginMessagePacket = new ClientPluginMessagePacket("MC|Brand", out.toByteArray());
        ((PCDownstreamSession) session.getDownstream()).send(clientPluginMessagePacket);
        LoginPacket loginpacket = (LoginPacket) session.getDataCache().remove(CacheKey.PACKET_LOGIN_PACKET);
        String clientLanguage = loginpacket.decoded.clientData.has("LanguageCode") ? loginpacket.decoded.clientData.get("LanguageCode").getAsString() : "en_US";
        session.getDataCache().put(CacheKey.PLAYER_LANGUAGE, clientLanguage);
        ClientSettingsPacket clientSettingsPacket = new ClientSettingsPacket(clientLanguage, (int) session.getDataCache().getOrDefault(CacheKey.PLAYER_REQUESTED_CHUNK_RADIUS, 5), ChatVisibility.FULL, false, new SkinPart[] {}, Hand.OFF_HAND);
        ((PCDownstreamSession) session.getDownstream()).send(clientSettingsPacket);
        UpdateAttributesPacket attr = new UpdateAttributesPacket();
        attr.rtid = entityPlayer.proxyEid;
        if (entityPlayer.attributes.isEmpty()) {
            attr.entries = new ArrayList();
            attr.entries.addAll(PEEntityAttribute.getDefault());
        } else
            attr.entries = entityPlayer.attributes.values();
        session.sendPacket(attr, true);
        AdventureSettingsPacket adv = new AdventureSettingsPacket();
        // flags
        adv.setFlag(AdventureSettingsPacket.WORLD_IMMUTABLE, restored.getGameMode().equals(GameMode.ADVENTURE));
        // adv.setFlag(AdventureSettingsPacket.NO_PVP, true);
        // adv.setFlag(AdventureSettingsPacket.AUTO_JUMP, true);
        adv.setFlag(AdventureSettingsPacket.ALLOW_FLIGHT, restored.getGameMode().equals(GameMode.CREATIVE) || restored.getGameMode().equals(GameMode.SPECTATOR));
        adv.setFlag(AdventureSettingsPacket.NO_CLIP, restored.getGameMode().equals(GameMode.SPECTATOR));
        adv.setFlag(AdventureSettingsPacket.WORLD_BUILDER, !restored.getGameMode().equals(GameMode.SPECTATOR) || !restored.getGameMode().equals(GameMode.ADVENTURE));
        adv.setFlag(AdventureSettingsPacket.FLYING, restored.getGameMode().equals(GameMode.SPECTATOR));
        adv.setFlag(AdventureSettingsPacket.MUTED, false);
        // custom permission flags (not necessary for now when using LEVEL_PERMISSION setting)
        // adv.setFlag(AdventureSettingsPacket.BUILD_AND_MINE, true);adv.setFlag(AdventureSettingsPacket.BUILD_AND_MINE, true);
        // adv.setFlag(AdventureSettingsPacket.DOORS_AND_SWITCHES, true);
        // adv.setFlag(AdventureSettingsPacket.OPEN_CONTAINERS, true);
        // adv.setFlag(AdventureSettingsPacket.ATTACK_PLAYERS, true);
        // adv.setFlag(AdventureSettingsPacket.ATTACK_MOBS, true);
        // adv.setFlag(AdventureSettingsPacket.OPERATOR, true);
        // adv.setFlag(AdventureSettingsPacket.TELEPORT, true);
        adv.eid = entityPlayer.proxyEid;
        // TODO update this with server configiration
        adv.commandsPermission = AdventureSettingsPacket.PERMISSION_NORMAL;
        // TODO update this with server configiration
        adv.playerPermission = AdventureSettingsPacket.LEVEL_PERMISSION_MEMBER;
        session.sendPacket(adv, true);
        SetEntityDataPacket entityData = new SetEntityDataPacket();
        entityData.rtid = entityPlayer.proxyEid;
        entityData.meta = EntityMetaData.createDefault();
        session.sendPacket(entityData, true);
        if (restored.getGameMode().equals(GameMode.CREATIVE))
            session.sendCreativeInventory();
        if (session.getProxy().getAuthMode().equalsIgnoreCase("online")) {
            MovePlayerPacket pk = new MovePlayerPacket();
            pk.rtid = entityPlayer.proxyEid;
            pk.mode = MovePlayerPacket.MODE_TELEPORT;
            pk.position = new Vector3F((float) packet.getX(), (float) packet.getY() + EntityType.PLAYER.getOffset() + 0.1f, (float) packet.getZ());
            pk.yaw = packet.getYaw();
            pk.pitch = packet.getPitch();
            pk.headYaw = packet.getYaw();
            if (entityPlayer.riding != 0) {
                CachedEntity vehicle = session.getEntityCache().getByLocalEID(entityPlayer.riding);
                if (vehicle != null)
                    pk.ridingRuntimeId = vehicle.eid;
            }
            session.sendPacket(pk, true);
        }
        // Notify the server
        BinaryStream bis = new BinaryStream();
        // command
        bis.putString("Notification");
        ClientPluginMessagePacket pluginMessage = new ClientPluginMessagePacket("DragonProxy", bis.get());
        session.getDownstream().send(pluginMessage);
        session.setSpawned();
        DragonProxy.getInstance().getLogger().info("Spawning " + session.getUsername() + " in world " + entityPlayer.dimention + " at " + entityPlayer.x + "/" + entityPlayer.y + "/" + entityPlayer.z);
        // send the confirmation
        ClientTeleportConfirmPacket confirm = new ClientTeleportConfirmPacket(packet.getTeleportId());
        ((PCDownstreamSession) session.getDownstream()).send(confirm);
        PlayerListPacket playerListPacket = new PlayerListPacket();
        Set<org.dragonet.protocol.type.PlayerListEntry> peEntries = new HashSet();
        for (CachedEntity entity : session.getEntityCache().getEntities().values()) {
            if (entity.peType == EntityType.PLAYER) {
                PlayerListEntry playerListEntry = session.getPlayerInfoCache().get(entity.playerUniqueId);
                org.dragonet.protocol.type.PlayerListEntry peEntry = new org.dragonet.protocol.type.PlayerListEntry();
                peEntry.uuid = entity.playerUniqueId;
                peEntry.eid = entity.eid;
                peEntry.username = playerListEntry.getProfile().getName();
                peEntry.skin = Skin.DEFAULT_SKIN_STEVE;
                peEntry.xboxUserId = "null";
                peEntries.add(peEntry);
            }
            entity.spawn(session);
        }
        playerListPacket.type = PlayerListPacket.TYPE_ADD;
        playerListPacket.entries = peEntries.toArray(new org.dragonet.protocol.type.PlayerListEntry[peEntries.size()]);
        session.sendPacket(playerListPacket);
        entityPlayer.spawned = true;
        return null;
    }
    entityPlayer.absoluteMove(packet.getX(), packet.getY() + entityPlayer.peType.getOffset() + 0.1f, packet.getZ(), packet.getYaw(), packet.getPitch());
    session.getChunkCache().sendOrderedChunks();
    float offset = 0.01f;
    byte mode = MovePlayerPacket.MODE_NORMAL;
    ChunkPos chunk = new ChunkPos(NukkitMath.ceilDouble(packet.getX()) >> 4, NukkitMath.ceilDouble(packet.getZ()) >> 4);
    // check if destination is out of range
    if (!session.getChunkCache().getLoadedChunks().contains(chunk)) {
        mode = MovePlayerPacket.MODE_TELEPORT;
        offset = 0.2f;
        // System.out.println(packet.getX() + " " + packet.getZ());
        // System.out.println("out of range !" + chunk.toString());
        session.getChunkCache().sendOrderedChunks();
    // session.getChunkCache().getDebugGrid();
    }
    MovePlayerPacket pk = new MovePlayerPacket();
    pk.rtid = entityPlayer.proxyEid;
    pk.mode = mode;
    pk.position = new Vector3F((float) packet.getX(), (float) packet.getY() + EntityType.PLAYER.getOffset() + offset, (float) packet.getZ());
    pk.yaw = packet.getYaw();
    pk.pitch = packet.getPitch();
    pk.headYaw = packet.getYaw();
    if (entityPlayer.riding != 0) {
        CachedEntity vehicle = session.getEntityCache().getByLocalEID(entityPlayer.riding);
        if (vehicle != null)
            pk.ridingRuntimeId = vehicle.eid;
    }
    // System.out.println("From server " + packet.getX() + " " + packet.getY() + " " + packet.getZ() + " ");
    // System.out.println("Entity position " + entityPlayer.x + " " + (entityPlayer.y - EntityType.PLAYER.getOffset()) + " " + entityPlayer.z + " ");
    session.sendPacket(pk);
    // send the confirmation
    ClientTeleportConfirmPacket confirm = new ClientTeleportConfirmPacket(packet.getTeleportId());
    ((PCDownstreamSession) session.getDownstream()).send(confirm);
    return null;
}
Also used : ArrayList(java.util.ArrayList) PlayerListEntry(com.github.steveice10.mc.protocol.data.game.PlayerListEntry) ClientSettingsPacket(com.github.steveice10.mc.protocol.packet.ingame.client.ClientSettingsPacket) Vector3F(org.dragonet.common.maths.Vector3F) ChunkPos(org.dragonet.common.maths.ChunkPos) HashSet(java.util.HashSet) CachedEntity(org.dragonet.proxy.network.cache.CachedEntity) BlockPosition(org.dragonet.common.maths.BlockPosition) ServerJoinGamePacket(com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket) BinaryStream(org.dragonet.common.utilities.BinaryStream) ClientTeleportConfirmPacket(com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket) ClientPluginMessagePacket(com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket) ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput) PCDownstreamSession(org.dragonet.proxy.network.PCDownstreamSession)

Example 2 with CachedEntity

use of org.dragonet.proxy.network.cache.CachedEntity in project DragonProxy by DragonetMC.

the class PEEntityEventPacketTranslator method translate.

@Override
public Packet[] translate(UpstreamSession session, EntityEventPacket packet) {
    CachedEntity player = session.getEntityCache().getClientEntity();
    if (packet.event == EntityEventPacket.EATING_ITEM) {
        long t = System.currentTimeMillis();
        if (t - player.lastFoodPacketTime > 380) {
            player.lastFoodPacketTime = t;
            player.foodPacketCount = 1;
            return null;
        }
        player.foodPacketCount++;
        player.lastFoodPacketTime = t;
        if (session.getEntityCache().getClientEntity().foodPacketCount == 7) {
            session.getEntityCache().getClientEntity().foodPacketCount = 0;
            player.lastFoodPacketTime = t;
            return null;
        }
    }
    return null;
}
Also used : CachedEntity(org.dragonet.proxy.network.cache.CachedEntity)

Example 3 with CachedEntity

use of org.dragonet.proxy.network.cache.CachedEntity in project DragonProxy by DragonetMC.

the class PEInventoryTransactionPacketTranslator method translate.

@Override
public Packet[] translate(UpstreamSession session, InventoryTransactionPacket packet) {
    // /!\ THIS IS A SIMPLE HANDLING WITHOUT JAVA DENY TRANSACTION
    switch(packet.transactionType) {
        case // 0 INVENTORY & CHEST
        InventoryTransactionPacket.TYPE_NORMAL:
            // System.out.println("TYPE_NORMAL");
            Slot cursor = null;
            if (// main inventory
            packet.actions.length <= 2 && packet.actions[0].sourceType == InventoryTransactionAction.SOURCE_WORLD && packet.actions[1].containerId == ContainerId.INVENTORY.getId()) {
                // drop item
                ClientPlayerActionPacket act = new ClientPlayerActionPacket(com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction.DROP_ITEM, new Position(0, 0, 0), BlockFace.DOWN);
                return new Packet[] { act };
            }
            // System.out.println("packet.actions[1].containerId " + packet.actions[1].containerId);
            if (packet.actions.length == 2 && packet.actions[0].sourceType == InventoryTransactionAction.SOURCE_CONTAINER && packet.actions[1].containerId == ContainerId.CURSOR.getId()) {
                // desktop version: click on an item (maybe pick/place/merge/swap)
                // System.out.println("packet.actions[0].oldItem " + packet.actions[0].oldItem);
                // System.out.println("packet.actions[0].newItem " + packet.actions[0].newItem);
                // System.out.println("packet.actions[1].oldItem " + packet.actions[1].oldItem);
                // System.out.println("packet.actions[1].newItem " + packet.actions[1].newItem);
                // set the cursor
                cursor = packet.actions[0].oldItem;
                int windowID = 0;
                if (session.getDataCache().containsKey(CacheKey.CURRENT_WINDOW_ID))
                    windowID = (int) session.getDataCache().get(CacheKey.CURRENT_WINDOW_ID);
                int size = 0;
                if (session.getDataCache().containsKey(CacheKey.CURRENT_WINDOW_SIZE))
                    size = (int) session.getDataCache().get(CacheKey.CURRENT_WINDOW_SIZE);
                int slot = packet.actions[0].slotId;
                int slotBE = packet.actions[0].slotId;
                if (windowID == 0) {
                    // Player inventory, no window
                    if (// Main Inventory
                    packet.actions[0].containerId == ContainerId.INVENTORY.getId())
                        if (// hotbar
                        slot < 9)
                            slot += size;
                    if (packet.actions[0].containerId == ContainerId.ARMOR.getId())
                        slot += 5;
                    if (// Crafting grid, not sure why 2 ids
                    packet.actions[0].containerId == -2 || packet.actions[0].containerId == -3)
                        slot += 1;
                } else {
                    if (packet.actions[0].containerId == ContainerId.INVENTORY.getId()) {
                        // if 0, source is player inv
                        if (// Top Inventory
                        slot >= 9)
                            slot -= 9;
                        else
                            // Hotbar offset
                            slot += size + 27;
                    }
                }
                // System.out.println("interact in chest (" + packet.actions[0].containerId + ") slot JE: " + slot + " BE:" + slotBE);
                // send action to server
                ClientWindowActionPacket windowActionPacket = new ClientWindowActionPacket(// window id
                windowID, // transaction id
                session.getWindowCache().currentTransactionId.incrementAndGet(), // slot
                slot, ItemBlockTranslator.translateToPC(cursor), WindowAction.CLICK_ITEM, ClickItemParam.LEFT_CLICK);
                // System.out.println("WINDOWACTIONPACKET \n" + DebugTools.getAllFields(windowActionPacket));
                session.getDownstream().send(windowActionPacket);
            // after the previous one, we can detect SHIFT click or move items on mobile devices
            // if (packet.actions.length == 2 && packet.actions[0].sourceType == InventoryTransactionAction.SOURCE_CONTAINER && packet.actions[1].sourceType == InventoryTransactionAction.SOURCE_CONTAINER)
            // mobile version: move item
            // desktop version: SHIFT-click item
            // System.out.println("Move item from " + packet.actions[0].containerId + " slot " + packet.actions[0].slotId
            // + " to " + packet.actions[1].containerId + " slot " + packet.actions[1].slotId);
            }
            // it's okay to return null
            return null;
        case // 1
        InventoryTransactionPacket.TYPE_MISMATCH:
            // System.out.println("TYPE_MISMATCH");
            break;
        case // 2
        InventoryTransactionPacket.TYPE_USE_ITEM:
            // System.out.println("TYPE_USE_ITEM");
            UseItemData useItemData = (UseItemData) packet.transactionData;
            if (useItemData.itemInHand.id == 346) {
                AddEntityPacket pk = new AddEntityPacket();
                return new Packet[] { new ClientPlayerUseItemPacket(Hand.MAIN_HAND) };
            }
            if (useItemData.blockPos.equals(new BlockPosition(0, 0, 0)))
                return new Packet[] { new ClientPlayerUseItemPacket(Hand.MAIN_HAND) };
            switch(useItemData.actionType) {
                case // 2
                InventoryTransactionPacket.USE_ITEM_ACTION_BREAK_BLOCK:
                    {
                        ClientPlayerActionPacket act = new ClientPlayerActionPacket(com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction.START_DIGGING, new Position(useItemData.blockPos.x, useItemData.blockPos.y, useItemData.blockPos.z), MagicValues.key(BlockFace.class, useItemData.face));
                        session.getDataCache().put(CacheKey.BLOCK_BREAKING_POSITION, act.getPosition());
                        return new Packet[] { act };
                    }
                // 0
                case InventoryTransactionPacket.USE_ITEM_ACTION_CLICK_BLOCK:
                case // 1
                InventoryTransactionPacket.USE_ITEM_ACTION_CLICK_AIR:
                    {
                        ClientPlayerPlaceBlockPacket placePacket = new ClientPlayerPlaceBlockPacket(new Position(useItemData.blockPos.x, useItemData.blockPos.y, useItemData.blockPos.z), ItemBlockTranslator.translateToPC(useItemData.face), Hand.MAIN_HAND, useItemData.clickPos.x, useItemData.clickPos.y, useItemData.clickPos.z);
                        return new Packet[] { placePacket, new ClientPlayerSwingArmPacket(Hand.MAIN_HAND) };
                    }
            }
        case // 3
        InventoryTransactionPacket.TYPE_USE_ITEM_ON_ENTITY:
            // System.out.println("TYPE_USE_ITEM_ON_ENTITY");
            UseItemOnEntityData useItemOnEntityData = (UseItemOnEntityData) packet.transactionData;
            CachedEntity cachedEntity = session.getEntityCache().getByLocalEID(useItemOnEntityData.entityRuntimeId);
            if (cachedEntity == null)
                return null;
            InteractAction interractAction = InteractAction.INTERACT;
            if (useItemOnEntityData.actionType == InventoryTransactionPacket.USE_ITEM_ON_ENTITY_ACTION_ATTACK)
                interractAction = InteractAction.ATTACK;
            ClientPlayerInteractEntityPacket interractPacket = new ClientPlayerInteractEntityPacket((int) cachedEntity.eid, interractAction);
            return new Packet[] { interractPacket };
        case // 4
        InventoryTransactionPacket.TYPE_RELEASE_ITEM:
            // System.out.println("TYPE_RELEASE_ITEM");
            if (((ReleaseItemData) packet.transactionData).actionType == 0)
                return new Packet[] { new ClientPlayerUseItemPacket(Hand.MAIN_HAND), new ClientPlayerActionPacket(PlayerAction.RELEASE_USE_ITEM, new Position(0, 0, 0), BlockFace.DOWN) };
            ReleaseItemData releaseItemData = (ReleaseItemData) packet.transactionData;
    }
    return null;
}
Also used : ClientWindowActionPacket(com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket) ClientPlayerUseItemPacket(com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket) ClientPlayerInteractEntityPacket(com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket) AddEntityPacket(org.dragonet.protocol.packets.AddEntityPacket) ClientPlayerSwingArmPacket(com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerSwingArmPacket) InventoryTransactionPacket(org.dragonet.protocol.packets.InventoryTransactionPacket) ClientPlayerActionPacket(com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket) Packet(com.github.steveice10.packetlib.packet.Packet) ClientWindowActionPacket(com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket) ClientPlayerPlaceBlockPacket(com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket) Position(com.github.steveice10.mc.protocol.data.game.entity.metadata.Position) BlockPosition(org.dragonet.common.maths.BlockPosition) ClientPlayerSwingArmPacket(com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerSwingArmPacket) AddEntityPacket(org.dragonet.protocol.packets.AddEntityPacket) BlockPosition(org.dragonet.common.maths.BlockPosition) CachedEntity(org.dragonet.proxy.network.cache.CachedEntity) ReleaseItemData(org.dragonet.protocol.type.transaction.data.ReleaseItemData) UseItemData(org.dragonet.protocol.type.transaction.data.UseItemData) ClientPlayerInteractEntityPacket(com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket) UseItemOnEntityData(org.dragonet.protocol.type.transaction.data.UseItemOnEntityData) InteractAction(com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction) ClientPlayerUseItemPacket(com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket) Slot(org.dragonet.common.data.inventory.Slot) ClientPlayerActionPacket(com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket) ClientPlayerPlaceBlockPacket(com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket)

Example 4 with CachedEntity

use of org.dragonet.proxy.network.cache.CachedEntity in project DragonProxy by DragonetMC.

the class PCSpawnMobPacketTranslator method translate.

public PEPacket[] translate(UpstreamSession session, ServerSpawnMobPacket packet) {
    try {
        CachedEntity entity = session.getEntityCache().newEntity(packet);
        if (entity == null) {
            return null;
        }
        entity.spawn(session);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : CachedEntity(org.dragonet.proxy.network.cache.CachedEntity)

Example 5 with CachedEntity

use of org.dragonet.proxy.network.cache.CachedEntity in project DragonProxy by DragonetMC.

the class PCSpawnPositionPacketTranslator method translate.

public PEPacket[] translate(UpstreamSession session, ServerSpawnPositionPacket packet) {
    CachedEntity entity = session.getEntityCache().getClientEntity();
    entity.spawnPosition = new BlockPosition(packet.getPosition());
    SetSpawnPositionPacket pk = new SetSpawnPositionPacket();
    pk.position = entity.spawnPosition;
    return new PEPacket[] {};
}
Also used : SetSpawnPositionPacket(org.dragonet.protocol.packets.SetSpawnPositionPacket) CachedEntity(org.dragonet.proxy.network.cache.CachedEntity) BlockPosition(org.dragonet.common.maths.BlockPosition) PEPacket(org.dragonet.protocol.PEPacket)

Aggregations

CachedEntity (org.dragonet.proxy.network.cache.CachedEntity)26 PEPacket (org.dragonet.protocol.PEPacket)14 Vector3F (org.dragonet.common.maths.Vector3F)9 BlockPosition (org.dragonet.common.maths.BlockPosition)5 MoveEntityPacket (org.dragonet.protocol.packets.MoveEntityPacket)5 UpdateAttributesPacket (org.dragonet.protocol.packets.UpdateAttributesPacket)3 ArrayList (java.util.ArrayList)2 MobEffectPacket (org.dragonet.protocol.packets.MobEffectPacket)2 PlayerListEntry (com.github.steveice10.mc.protocol.data.game.PlayerListEntry)1 Attribute (com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute)1 ItemStack (com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack)1 Position (com.github.steveice10.mc.protocol.data.game.entity.metadata.Position)1 InteractAction (com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction)1 ClientPluginMessagePacket (com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket)1 ClientSettingsPacket (com.github.steveice10.mc.protocol.packet.ingame.client.ClientSettingsPacket)1 ClientPlayerActionPacket (com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket)1 ClientPlayerInteractEntityPacket (com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket)1 ClientPlayerPlaceBlockPacket (com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket)1 ClientPlayerPositionRotationPacket (com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket)1 ClientPlayerSwingArmPacket (com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerSwingArmPacket)1