protocolsupport.protocol.ConnectionImpl Java Examples
The following examples show how to use
protocolsupport.protocol.ConnectionImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayerMovePacket.java From ProtocolSupportPocketStuff with GNU Affero General Public License v3.0 | 6 votes |
@Override public void readFromClientData(ConnectionImpl connection, ByteBuf clientdata) { this.entityId = VarNumberSerializer.readSVarLong(clientdata); this.x = clientdata.readFloatLE(); this.y = clientdata.readFloatLE(); this.z = clientdata.readFloatLE(); this.pitch = clientdata.readFloatLE(); this.headYaw = clientdata.readFloatLE(); this.mode = clientdata.readByte(); this.onGround = clientdata.readBoolean(); VarNumberSerializer.readVarInt(clientdata); if (mode == 2) { VarNumberSerializer.readSVarInt(clientdata); VarNumberSerializer.readSVarInt(clientdata); } }
Example #2
Source File: InitialPacketDecoder.java From ProtocolSupport with GNU Affero General Public License v3.0 | 6 votes |
protected void setProtocol(Channel channel, ProtocolVersion version) { ConnectionImpl connection = prepare(channel, version); IPipeLineBuilder builder = pipelineBuilders.get(connection.getVersion()); builder.buildCodec(channel, connection); if (encapsulatedinfo == null) { builder.buildPipeLine(channel, connection); } else { PlatformUtils putils = ServerPlatform.get().getMiscUtils(); putils.setFraming(channel.pipeline(), new VarIntFrameDecoder(), new VarIntFrameEncoder()); if (encapsulatedinfo.hasCompression()) { putils.enableCompression(channel.pipeline(), putils.getCompressionThreshold()); } if ((encapsulatedinfo.getAddress() != null) && connection.getRawAddress().getAddress().isLoopbackAddress()) { connection.changeAddress(encapsulatedinfo.getAddress()); } } buffer.readerIndex(0); channel.pipeline().firstContext().fireChannelRead(buffer.unwrap()); }
Example #3
Source File: SpawnEntityPacket.java From ProtocolSupportPocketStuff with GNU Affero General Public License v3.0 | 6 votes |
@Override public void toData(ConnectionImpl connection, ByteBuf serializer) { VarNumberSerializer.writeSVarLong(serializer, entityId); // entity ID VarNumberSerializer.writeVarLong(serializer, entityId); // runtime ID VarNumberSerializer.writeVarInt(serializer, entityType); // boss bar entity id serializer.writeFloatLE(x); // x serializer.writeFloatLE(y); // y serializer.writeFloatLE(z); // z serializer.writeFloatLE(motionX); // motx serializer.writeFloatLE(motionY); // moty serializer.writeFloatLE(motionZ); // motz serializer.writeFloatLE(pitch); // pitch serializer.writeFloatLE(yaw); // yaw // We can't use SetAttributePackets#encodeAttributes because MCPE uses an different format in SpawnEntityPacket (why mojang?) VarNumberSerializer.writeVarInt(serializer, attributes.size()); for (SetAttributesPacket.Attribute attribute : attributes) { StringSerializer.writeString(serializer, connection.getVersion(), attribute.getName()); serializer.writeFloatLE(attribute.getMinimum()); serializer.writeFloatLE(attribute.getValue()); serializer.writeFloatLE(attribute.getMaximum()); } //TODO: fix VarNumberSerializer.writeVarInt(serializer, 0); //EntityMetadata.encodeMeta(serializer, connection.getVersion(), I18NData.DEFAULT_LOCALE, metadata); VarNumberSerializer.writeVarInt(serializer, 0); //links, not used }
Example #4
Source File: PipeLineBuilder.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override public void buildCodec(Channel channel, ConnectionImpl connection) { ChannelPipeline pipeline = channel.pipeline(); PacketDecoder decoder = new PacketDecoder(connection); PacketEncoder encoder = new PacketEncoder(connection); pipeline.addAfter(ChannelHandlers.RAW_CAPTURE_RECEIVE, ChannelHandlers.DECODER_TRANSFORMER, decoder); pipeline.addAfter(ChannelHandlers.RAW_CAPTURE_SEND, ChannelHandlers.ENCODER_TRANSFORMER, encoder); connection.initCodec(PacketCodec.instance, encoder, decoder); }
Example #5
Source File: ResourcePackDataInfoPacket.java From ProtocolSupportPocketStuff with GNU Affero General Public License v3.0 | 5 votes |
@Override public void toData(ConnectionImpl connection, ByteBuf serializer) { StringSerializer.writeString(serializer, ProtocolVersionsHelper.LATEST_PE, pack.getPackId()); serializer.writeIntLE(ResourcePackChunkDataPacket.CHUNK_SIZE); //max chunk size 1MB serializer.writeIntLE((int) Math.ceil(pack.getPackSize() / ResourcePackChunkDataPacket.CHUNK_SIZE)); //chunk count serializer.writeLongLE(pack.getPackSize()); //res pack size byte[] hash = pack.getSha256(); ArraySerializer.writeVarIntByteArray(serializer, hash); }
Example #6
Source File: SpawnPlayerPacket.java From ProtocolSupportPocketStuff with GNU Affero General Public License v3.0 | 5 votes |
@Override public void toData(ConnectionImpl connection, ByteBuf serializer) { MiscSerializer.writePEUUID(serializer, uuid); StringSerializer.writeString(serializer, connection.getVersion(), name); StringSerializer.writeString(serializer, connection.getVersion(), ""); //ThirdPartyName :F VarNumberSerializer.writeVarInt(serializer, 0); //Platform VarNumberSerializer.writeSVarLong(serializer, entityId); // entity ID VarNumberSerializer.writeVarLong(serializer, entityId); // runtime ID StringSerializer.writeString(serializer, connection.getVersion(), ""); //Chat :F serializer.writeFloatLE(x); // x serializer.writeFloatLE(y); // y serializer.writeFloatLE(z); // z serializer.writeFloatLE(motionX); // motx serializer.writeFloatLE(motionY); // moty serializer.writeFloatLE(motionZ); // motz serializer.writeFloatLE(pitch); // pitch serializer.writeFloatLE(headYaw); // yaw serializer.writeFloatLE(yaw); // yaw //ItemStackSerializer.writeItemStack(serializer, connection.getVersion(), connection.getCache().getAttributesCache().getLocale(), NetworkItemStack.NULL, true); //held item. ItemStackSerializer.writeItemStack(serializer,NetworkItemStack.NULL); //TODO Fix! VarNumberSerializer.writeVarInt(serializer, 0); //EntityMetadata.encodeMeta(serializer, connection.getVersion(), connection.getCache().getAttributesCache().getLocale(), metadata); //adventure settings VarNumberSerializer.writeVarInt(serializer, 0); VarNumberSerializer.writeVarInt(serializer, 0); VarNumberSerializer.writeVarInt(serializer, 0); VarNumberSerializer.writeVarInt(serializer, 0); VarNumberSerializer.writeVarInt(serializer, 0); serializer.writeLongLE(0); //? VarNumberSerializer.writeSVarInt(serializer, 0); //links, not used }
Example #7
Source File: EntityRelMoveLook.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public EntityRelMoveLook(ConnectionImpl connection) { super(connection); }
Example #8
Source File: EntityEffectAdd.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public EntityEffectAdd(ConnectionImpl connection) { super(connection); }
Example #9
Source File: MiddleMoveVehicle.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public MiddleMoveVehicle(ConnectionImpl connection) { super(connection); }
Example #10
Source File: MiddleEntityTeleport.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public MiddleEntityTeleport(ConnectionImpl connection) { super(connection); }
Example #11
Source File: MiddleScoreboardTeam.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public MiddleScoreboardTeam(ConnectionImpl connection) { super(connection); }
Example #12
Source File: UpdateMap.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public UpdateMap(ConnectionImpl connection) { super(connection); }
Example #13
Source File: PacketEncoder.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public PacketEncoder(ConnectionImpl connection) { super(connection); }
Example #14
Source File: WorldEvent.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public WorldEvent(ConnectionImpl connection) { super(connection); }
Example #15
Source File: PipeLineBuilder.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@Override public void buildCodec(Channel channel, ConnectionImpl connection) { }
Example #16
Source File: MiddleEntityMetadata.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public MiddleEntityMetadata(ConnectionImpl connection) { super(connection); }
Example #17
Source File: EntityPassengers.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public EntityPassengers(ConnectionImpl connection) { super(connection); }
Example #18
Source File: InventoryOpen.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public InventoryOpen(ConnectionImpl connection) { super(connection); }
Example #19
Source File: InventoryOpen.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public InventoryOpen(ConnectionImpl connection) { super(connection); }
Example #20
Source File: SetCooldown.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public SetCooldown(ConnectionImpl connection) { super(connection); }
Example #21
Source File: SetBeaconEffect.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public SetBeaconEffect(ConnectionImpl connection) { super(connection); }
Example #22
Source File: MiddleQueryBlockNBT.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public MiddleQueryBlockNBT(ConnectionImpl connection) { super(connection); }
Example #23
Source File: Animation.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public Animation(ConnectionImpl connection) { super(connection); }
Example #24
Source File: NoopStopSound.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public NoopStopSound(ConnectionImpl connection) { super(connection); }
Example #25
Source File: MiddleUnlockRecipes.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public MiddleUnlockRecipes(ConnectionImpl connection) { super(connection); }
Example #26
Source File: KeepAlive.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public KeepAlive(ConnectionImpl connection) { super(connection); }
Example #27
Source File: MiddlePacket.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public MiddlePacket(ConnectionImpl connection) { this.connection = connection; this.codec = connection.getCodec(); this.cache = connection.getCache(); this.version = connection.getVersion(); }
Example #28
Source File: ScoreboardObjective.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public ScoreboardObjective(ConnectionImpl connection) { super(connection); }
Example #29
Source File: AbstractScoreboardTeam.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public AbstractScoreboardTeam(ConnectionImpl connection) { super(connection); }
Example #30
Source File: ChunkData.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
public ChunkData(ConnectionImpl connection) { super(connection); }