Search in sources :

Example 16 with Protocol1_9To1_8

use of com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8 in project ViaVersion by ViaVersion.

the class ProtocolManagerImpl method registerProtocols.

public void registerProtocols() {
    // Base Protocol
    registerBaseProtocol(BASE_PROTOCOL, Range.lessThan(Integer.MIN_VALUE));
    registerBaseProtocol(new BaseProtocol1_7(), Range.lessThan(ProtocolVersion.v1_16.getVersion()));
    registerBaseProtocol(new BaseProtocol1_16(), Range.atLeast(ProtocolVersion.v1_16.getVersion()));
    registerProtocol(new Protocol1_9To1_8(), ProtocolVersion.v1_9, ProtocolVersion.v1_8);
    registerProtocol(new Protocol1_9_1To1_9(), Arrays.asList(ProtocolVersion.v1_9_1.getVersion(), ProtocolVersion.v1_9_2.getVersion()), ProtocolVersion.v1_9.getVersion());
    registerProtocol(new Protocol1_9_3To1_9_1_2(), ProtocolVersion.v1_9_3, ProtocolVersion.v1_9_2);
    registerProtocol(new Protocol1_9To1_9_1(), ProtocolVersion.v1_9, ProtocolVersion.v1_9_1);
    registerProtocol(new Protocol1_9_1_2To1_9_3_4(), Arrays.asList(ProtocolVersion.v1_9_1.getVersion(), ProtocolVersion.v1_9_2.getVersion()), ProtocolVersion.v1_9_3.getVersion());
    registerProtocol(new Protocol1_10To1_9_3_4(), ProtocolVersion.v1_10, ProtocolVersion.v1_9_3);
    registerProtocol(new Protocol1_11To1_10(), ProtocolVersion.v1_11, ProtocolVersion.v1_10);
    registerProtocol(new Protocol1_11_1To1_11(), ProtocolVersion.v1_11_1, ProtocolVersion.v1_11);
    registerProtocol(new Protocol1_12To1_11_1(), ProtocolVersion.v1_12, ProtocolVersion.v1_11_1);
    registerProtocol(new Protocol1_12_1To1_12(), ProtocolVersion.v1_12_1, ProtocolVersion.v1_12);
    registerProtocol(new Protocol1_12_2To1_12_1(), ProtocolVersion.v1_12_2, ProtocolVersion.v1_12_1);
    registerProtocol(new Protocol1_13To1_12_2(), ProtocolVersion.v1_13, ProtocolVersion.v1_12_2);
    registerProtocol(new Protocol1_13_1To1_13(), ProtocolVersion.v1_13_1, ProtocolVersion.v1_13);
    registerProtocol(new Protocol1_13_2To1_13_1(), ProtocolVersion.v1_13_2, ProtocolVersion.v1_13_1);
    registerProtocol(new Protocol1_14To1_13_2(), ProtocolVersion.v1_14, ProtocolVersion.v1_13_2);
    registerProtocol(new Protocol1_14_1To1_14(), ProtocolVersion.v1_14_1, ProtocolVersion.v1_14);
    registerProtocol(new Protocol1_14_2To1_14_1(), ProtocolVersion.v1_14_2, ProtocolVersion.v1_14_1);
    registerProtocol(new Protocol1_14_3To1_14_2(), ProtocolVersion.v1_14_3, ProtocolVersion.v1_14_2);
    registerProtocol(new Protocol1_14_4To1_14_3(), ProtocolVersion.v1_14_4, ProtocolVersion.v1_14_3);
    registerProtocol(new Protocol1_15To1_14_4(), ProtocolVersion.v1_15, ProtocolVersion.v1_14_4);
    registerProtocol(new Protocol1_15_1To1_15(), ProtocolVersion.v1_15_1, ProtocolVersion.v1_15);
    registerProtocol(new Protocol1_15_2To1_15_1(), ProtocolVersion.v1_15_2, ProtocolVersion.v1_15_1);
    registerProtocol(new Protocol1_16To1_15_2(), ProtocolVersion.v1_16, ProtocolVersion.v1_15_2);
    registerProtocol(new Protocol1_16_1To1_16(), ProtocolVersion.v1_16_1, ProtocolVersion.v1_16);
    registerProtocol(new Protocol1_16_2To1_16_1(), ProtocolVersion.v1_16_2, ProtocolVersion.v1_16_1);
    registerProtocol(new Protocol1_16_3To1_16_2(), ProtocolVersion.v1_16_3, ProtocolVersion.v1_16_2);
    registerProtocol(new Protocol1_16_4To1_16_3(), ProtocolVersion.v1_16_4, ProtocolVersion.v1_16_3);
    registerProtocol(new Protocol1_17To1_16_4(), ProtocolVersion.v1_17, ProtocolVersion.v1_16_4);
    registerProtocol(new Protocol1_17_1To1_17(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_17);
    registerProtocol(new Protocol1_18To1_17_1(), ProtocolVersion.v1_18, ProtocolVersion.v1_17_1);
    registerProtocol(new Protocol1_18_2To1_18(), ProtocolVersion.v1_18_2, ProtocolVersion.v1_18);
}
Also used : Protocol1_14_4To1_14_3(com.viaversion.viaversion.protocols.protocol1_14_4to1_14_3.Protocol1_14_4To1_14_3) Protocol1_16_2To1_16_1(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1) Protocol1_16_3To1_16_2(com.viaversion.viaversion.protocols.protocol1_16_3to1_16_2.Protocol1_16_3To1_16_2) Protocol1_12To1_11_1(com.viaversion.viaversion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1) Protocol1_11To1_10(com.viaversion.viaversion.protocols.protocol1_11to1_10.Protocol1_11To1_10) Protocol1_14_3To1_14_2(com.viaversion.viaversion.protocols.protocol1_14_3to1_14_2.Protocol1_14_3To1_14_2) Protocol1_11_1To1_11(com.viaversion.viaversion.protocols.protocol1_11_1to1_11.Protocol1_11_1To1_11) Protocol1_13To1_12_2(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2) Protocol1_16_4To1_16_3(com.viaversion.viaversion.protocols.protocol1_16_4to1_16_3.Protocol1_16_4To1_16_3) Protocol1_14_2To1_14_1(com.viaversion.viaversion.protocols.protocol1_14_2to1_14_1.Protocol1_14_2To1_14_1) Protocol1_12_1To1_12(com.viaversion.viaversion.protocols.protocol1_12_1to1_12.Protocol1_12_1To1_12) Protocol1_14_1To1_14(com.viaversion.viaversion.protocols.protocol1_14_1to1_14.Protocol1_14_1To1_14) Protocol1_15_1To1_15(com.viaversion.viaversion.protocols.protocol1_15_1to1_15.Protocol1_15_1To1_15) Protocol1_16To1_15_2(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2) Protocol1_17To1_16_4(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4) Protocol1_16_1To1_16(com.viaversion.viaversion.protocols.protocol1_16_1to1_16.Protocol1_16_1To1_16) Protocol1_13_1To1_13(com.viaversion.viaversion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13) Protocol1_14To1_13_2(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2) Protocol1_12_2To1_12_1(com.viaversion.viaversion.protocols.protocol1_12_2to1_12_1.Protocol1_12_2To1_12_1) Protocol1_9_1To1_9(com.viaversion.viaversion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9) Protocol1_18_2To1_18(com.viaversion.viaversion.protocols.protocol1_18_2to1_18.Protocol1_18_2To1_18) BaseProtocol1_7(com.viaversion.viaversion.protocols.base.BaseProtocol1_7) Protocol1_15To1_14_4(com.viaversion.viaversion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4) Protocol1_9To1_9_1(com.viaversion.viaversion.protocols.protocol1_9to1_9_1.Protocol1_9To1_9_1) Protocol1_15_2To1_15_1(com.viaversion.viaversion.protocols.protocol1_15_2to1_15_1.Protocol1_15_2To1_15_1) Protocol1_10To1_9_3_4(com.viaversion.viaversion.protocols.protocol1_10to1_9_3.Protocol1_10To1_9_3_4) Protocol1_13_2To1_13_1(com.viaversion.viaversion.protocols.protocol1_13_2to1_13_1.Protocol1_13_2To1_13_1) Protocol1_17_1To1_17(com.viaversion.viaversion.protocols.protocol1_17_1to1_17.Protocol1_17_1To1_17) Protocol1_18To1_17_1(com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1) Protocol1_9_3To1_9_1_2(com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3To1_9_1_2) BaseProtocol1_16(com.viaversion.viaversion.protocols.base.BaseProtocol1_16) Protocol1_9_1_2To1_9_3_4(com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4) Protocol1_9To1_8(com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8)

Example 17 with Protocol1_9To1_8

use of com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8 in project ViaVersion by ViaVersion.

the class BungeeMovementTransmitter method sendPlayer.

public void sendPlayer(UserConnection userConnection) {
    if (userConnection.getProtocolInfo().getState() == State.PLAY) {
        PacketWrapper wrapper = PacketWrapper.create(ServerboundPackets1_8.PLAYER_MOVEMENT, null, userConnection);
        MovementTracker tracker = userConnection.get(MovementTracker.class);
        wrapper.write(Type.BOOLEAN, tracker.isGround());
        try {
            wrapper.scheduleSendToServer(Protocol1_9To1_8.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        tracker.incrementIdlePacket();
    }
}
Also used : PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) MovementTracker(com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.MovementTracker)

Example 18 with Protocol1_9To1_8

use of com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8 in project ViaVersion by ViaVersion.

the class ElytraPatch method onServerConnected.

@EventHandler(priority = EventPriority.HIGH)
public void onServerConnected(ServerConnectedEvent event) {
    UserConnection user = Via.getManager().getConnectionManager().getConnectedClient(event.getPlayer().getUniqueId());
    if (user == null)
        return;
    try {
        if (user.getProtocolInfo().getPipeline().contains(Protocol1_9To1_8.class)) {
            EntityTracker1_9 tracker = user.getEntityTracker(Protocol1_9To1_8.class);
            int entityId = tracker.getProvidedEntityId();
            PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9.ENTITY_METADATA, null, user);
            wrapper.write(Type.VAR_INT, entityId);
            wrapper.write(Types1_9.METADATA_LIST, Collections.singletonList(new Metadata(0, MetaType1_9.Byte, (byte) 0)));
            wrapper.scheduleSend(Protocol1_9To1_8.class);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : EntityTracker1_9(com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.EntityTracker1_9) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) Metadata(com.viaversion.viaversion.api.minecraft.metadata.Metadata) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) EventHandler(net.md_5.bungee.event.EventHandler)

Example 19 with Protocol1_9To1_8

use of com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8 in project ViaVersion by ViaVersion.

the class BlockListener method placeBlock.

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void placeBlock(BlockPlaceEvent e) {
    if (isOnPipe(e.getPlayer())) {
        Block b = e.getBlockPlaced();
        EntityTracker1_9 tracker = getUserConnection(e.getPlayer()).getEntityTracker(Protocol1_9To1_8.class);
        tracker.addBlockInteraction(new Position(b.getX(), (short) b.getY(), b.getZ()));
    }
}
Also used : EntityTracker1_9(com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.EntityTracker1_9) Position(com.viaversion.viaversion.api.minecraft.Position) Block(org.bukkit.block.Block) EventHandler(org.bukkit.event.EventHandler)

Aggregations

PacketWrapper (com.viaversion.viaversion.api.protocol.packet.PacketWrapper)14 EntityTracker1_9 (com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.EntityTracker1_9)10 PacketRemapper (com.viaversion.viaversion.api.protocol.remapper.PacketRemapper)7 Protocol1_9To1_8 (com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8)7 Item (com.viaversion.viaversion.api.minecraft.item.Item)6 PacketHandler (com.viaversion.viaversion.api.protocol.remapper.PacketHandler)6 UserConnection (com.viaversion.viaversion.api.connection.UserConnection)5 Metadata (com.viaversion.viaversion.api.minecraft.metadata.Metadata)5 Type (com.viaversion.viaversion.api.type.Type)4 Via (com.viaversion.viaversion.api.Via)3 ProtocolInfo (com.viaversion.viaversion.api.connection.ProtocolInfo)3 DataItem (com.viaversion.viaversion.api.minecraft.item.DataItem)3 ClientWorld (com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld)3 CompoundTag (com.github.steveice10.opennbt.tag.builtin.CompoundTag)2 StringTag (com.github.steveice10.opennbt.tag.builtin.StringTag)2 JsonObject (com.google.gson.JsonObject)2 Position (com.viaversion.viaversion.api.minecraft.Position)2 Chunk (com.viaversion.viaversion.api.minecraft.chunks.Chunk)2 ChunkSection (com.viaversion.viaversion.api.minecraft.chunks.ChunkSection)2 Entity1_12Types (com.viaversion.viaversion.api.minecraft.entities.Entity1_12Types)2