mirror of
https://github.com/ViaVersion/ViaLegacy.git
synced 2024-11-16 10:55:23 +01:00
Create PLUGIN_MESSAGE packets without input buffers
This commit is contained in:
parent
3f57c28d65
commit
d7e33fa011
@ -27,7 +27,6 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.CustomByteType;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.raphimc.vialegacy.ViaLegacy;
|
||||
import net.raphimc.vialegacy.api.data.BlockList1_6;
|
||||
import net.raphimc.vialegacy.api.model.ChunkCoord;
|
||||
@ -75,7 +74,7 @@ public class Protocolc0_30toc0_30cpe extends StatelessProtocol<ClientboundPacket
|
||||
handler(wrapper -> {
|
||||
if (wrapper.user().getProtocolInfo().getPipeline().contains(Protocol1_6_2to1_6_1.class)) {
|
||||
final ExtensionProtocolMetadataStorage protocolMetadataStorage = wrapper.user().get(ExtensionProtocolMetadataStorage.class);
|
||||
final PacketWrapper brand = PacketWrapper.create(ClientboundPackets1_6_4.PLUGIN_MESSAGE, Unpooled.buffer(), wrapper.user());
|
||||
final PacketWrapper brand = PacketWrapper.create(ClientboundPackets1_6_4.PLUGIN_MESSAGE, wrapper.user());
|
||||
brand.write(Types1_6_4.STRING, "MC|Brand");
|
||||
final byte[] brandBytes = protocolMetadataStorage.getServerSoftwareName().getBytes(StandardCharsets.UTF_8);
|
||||
brand.write(Type.SHORT, (short) brandBytes.length); // data length
|
||||
|
@ -23,7 +23,6 @@ import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.raphimc.vialegacy.api.data.ItemList1_6;
|
||||
import net.raphimc.vialegacy.api.protocol.StatelessProtocol;
|
||||
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
|
||||
@ -47,7 +46,7 @@ public class Protocol1_6_2to1_6_1 extends StatelessProtocol<ClientboundPackets1_
|
||||
@Override
|
||||
public void register() {
|
||||
handler(wrapper -> {
|
||||
final PacketWrapper brand = PacketWrapper.create(ClientboundPackets1_6_4.PLUGIN_MESSAGE, Unpooled.buffer(), wrapper.user());
|
||||
final PacketWrapper brand = PacketWrapper.create(ClientboundPackets1_6_4.PLUGIN_MESSAGE, wrapper.user());
|
||||
brand.write(Types1_6_4.STRING, "MC|Brand");
|
||||
final byte[] brandBytes = "legacy".getBytes(StandardCharsets.UTF_8);
|
||||
brand.write(Type.SHORT, (short) brandBytes.length); // data length
|
||||
|
Loading…
Reference in New Issue
Block a user