Skip to content

Package net.minecraft.network.protocol

Part 1/1


BundleDelimiterPacket

  • Full name: net.minecraft.network.protocol.BundleDelimiterPacket
  • Package: net.minecraft.network.protocol
  • Source: commonnet/minecraft/network/protocol/BundleDelimiterPacket.java
  • Type: class
  • Modifiers: public abstract
  • Implements: Packet<T>

net.minecraft.network.protocol.BundleDelimiterPacket#handle(T)

  • Origin: common
  • Source: net/minecraft/network/protocol/BundleDelimiterPacket.java:6
  • Modifiers: public final
  • Return: void

คืออะไร

จัดการ handle

ทำงานยังไง

สร้างออบเจ็กต์: AssertionError.

Parameters

  • T packetListener

ตัวอย่างใช้งาน

BundleDelimiterPacket instance = ...;
T packetListener = ...;
instance.handle(packetListener);

net.minecraft.network.protocol.BundleDelimiterPacket#type()

  • Origin: common
  • Source: net/minecraft/network/protocol/BundleDelimiterPacket.java:11
  • Modifiers: public abstract
  • Return: PacketType<? extends BundleDelimiterPacket<T>>

คืออะไร

ดำเนินการ type ตาม implementation ของ BundleDelimiterPacket

ทำงานยังไง

ไม่มี implementation ใน declaration นี้; คลาสลูก/implementation เป็นผู้กำหนดพฤติกรรมจริง

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

BundleDelimiterPacket instance = ...;
PacketType<? extends BundleDelimiterPacket<T>> result = instance.type();

BundlePacket

  • Full name: net.minecraft.network.protocol.BundlePacket
  • Package: net.minecraft.network.protocol
  • Source: commonnet/minecraft/network/protocol/BundlePacket.java
  • Type: class
  • Modifiers: public abstract
  • Implements: Packet<T>

net.minecraft.network.protocol.BundlePacket#BundlePacket(Iterable<Packet<? super T>>)

  • Origin: common
  • Source: net/minecraft/network/protocol/BundlePacket.java:8
  • Modifiers: protected
  • Kind: constructor

คืออะไร

สร้างออบเจ็กต์ BundlePacket ด้วยพารามิเตอร์ที่ระบุ

ทำงานยังไง

แก้ state: packets.

Parameters

  • Iterable<Packet<? super T>> iterable

ตัวอย่างใช้งาน

Iterable<Packet<? super T>> iterable = ...;
BundlePacket instance = new BundlePacket(iterable);

net.minecraft.network.protocol.BundlePacket#subPackets()

  • Origin: common
  • Source: net/minecraft/network/protocol/BundlePacket.java:12
  • Modifiers: public final
  • Return: Iterable<Packet<? super T>>

คืออะไร

ดำเนินการ subPackets ตาม implementation ของ BundlePacket

ทำงานยังไง

คืนค่า: this.packets.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

BundlePacket instance = ...;
Iterable<Packet<? super T>> result = instance.subPackets();

net.minecraft.network.protocol.BundlePacket#type()

  • Origin: common
  • Source: net/minecraft/network/protocol/BundlePacket.java:16
  • Modifiers: public abstract
  • Return: PacketType<? extends BundlePacket<T>>

คืออะไร

ดำเนินการ type ตาม implementation ของ BundlePacket

ทำงานยังไง

ไม่มี implementation ใน declaration นี้; คลาสลูก/implementation เป็นผู้กำหนดพฤติกรรมจริง

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

BundlePacket instance = ...;
PacketType<? extends BundlePacket<T>> result = instance.type();

BundlerInfo

  • Full name: net.minecraft.network.protocol.BundlerInfo
  • Package: net.minecraft.network.protocol
  • Source: commonnet/minecraft/network/protocol/BundlerInfo.java
  • Type: interface
  • Modifiers: public

net.minecraft.network.protocol.BundlerInfo#createForPacket(PacketType<P>,Function<Iterable<Packet<? super T>>, P>,BundleDelimiterPacket<? super T>)

  • Origin: common
  • Source: net/minecraft/network/protocol/BundlerInfo.java:13
  • Modifiers: static
  • Return: BundlerInfo

คืออะไร

สร้าง For Packet

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: unbundlePacket(), type(), accept(), subPackets(), forEach(), startPacketBundling(), Bundler(), addPacket(). สร้างออบเจ็กต์: BundlerInfo, BundlerInfo.Bundler, ArrayList<>, IllegalStateException. มีจุด return อย่างน้อย 3 จุด.

Parameters

  • PacketType<P> packetType
  • Function<Iterable<Packet<? super T>>, P> function
  • BundleDelimiterPacket<? super T> bundleDelimiterPacket

ตัวอย่างใช้งาน

PacketType<P> packetType = ...;
Function<Iterable<Packet<? super T>>, P> function = ...;
BundleDelimiterPacket<? super T> bundleDelimiterPacket = ...;
BundlerInfo result = BundlerInfo.createForPacket(packetType, function, bundleDelimiterPacket);

net.minecraft.network.protocol.BundlerInfo#startPacketBundling(Packet<?>)

  • Origin: common
  • Source: net/minecraft/network/protocol/BundlerInfo.java:57
  • Modifiers: ``
  • Return: BundlerInfo.Bundler

คืออะไร

เริ่ม Packet Bundling

ทำงานยังไง

ไม่มี body ใน source declaration นี้

Parameters

  • Packet<?> packet

ตัวอย่างใช้งาน

BundlerInfo instance = ...;
Packet<?> packet = ...;
BundlerInfo.Bundler result = instance.startPacketBundling(packet);

net.minecraft.network.protocol.BundlerInfo#unbundlePacket(Packet<?>,Consumer<Packet<?>>)

  • Origin: common
  • Source: net/minecraft/network/protocol/BundlerInfo.java:55
  • Modifiers: ``
  • Return: void

คืออะไร

ดำเนินการ unbundlePacket ตาม implementation ของ BundlerInfo

ทำงานยังไง

ไม่มี body ใน source declaration นี้

Parameters

  • Packet<?> packet
  • Consumer<Packet<?>> consumer

ตัวอย่างใช้งาน

BundlerInfo instance = ...;
Packet<?> packet = ...;
Consumer<Packet<?>> consumer = ...;
instance.unbundlePacket(packet, consumer);

Packet

  • Full name: net.minecraft.network.protocol.Packet
  • Package: net.minecraft.network.protocol
  • Source: commonnet/minecraft/network/protocol/Packet.java
  • Type: interface
  • Modifiers: public

net.minecraft.network.protocol.Packet#codec(StreamMemberEncoder<B, T>,StreamDecoder<B, T>)

  • Origin: common
  • Source: net/minecraft/network/protocol/Packet.java:22
  • Modifiers: static
  • Return: StreamCodec<B, T>

คืออะไร

ดำเนินการ codec ตาม implementation ของ Packet

ทำงานยังไง

เรียกต่อ: ofMember(). คืนค่า: StreamCodec.ofMember(streamMemberEncoder, streamDecoder).

Parameters

  • StreamMemberEncoder<B, T> streamMemberEncoder
  • StreamDecoder<B, T> streamDecoder

ตัวอย่างใช้งาน

StreamMemberEncoder<B, T> streamMemberEncoder = ...;
StreamDecoder<B, T> streamDecoder = ...;
StreamCodec<B, T> result = Packet.codec(streamMemberEncoder, streamDecoder);

net.minecraft.network.protocol.Packet#handle(T)

  • Origin: common
  • Source: net/minecraft/network/protocol/Packet.java:12
  • Modifiers: ``
  • Return: void

คืออะไร

จัดการ handle

ทำงานยังไง

ไม่มี body ใน source declaration นี้

Parameters

  • T packetListener

ตัวอย่างใช้งาน

Packet instance = ...;
T packetListener = ...;
instance.handle(packetListener);

net.minecraft.network.protocol.Packet#isSkippable()

  • Origin: common
  • Source: net/minecraft/network/protocol/Packet.java:14
  • Modifiers: default
  • Return: boolean

คืออะไร

ตรวจสอบสถานะ Skippable

ทำงานยังไง

คืนค่า: false.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

Packet instance = ...;
boolean result = instance.isSkippable();

net.minecraft.network.protocol.Packet#isTerminal()

  • Origin: common
  • Source: net/minecraft/network/protocol/Packet.java:18
  • Modifiers: default
  • Return: boolean

คืออะไร

ตรวจสอบสถานะ Terminal

ทำงานยังไง

คืนค่า: false.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

Packet instance = ...;
boolean result = instance.isTerminal();

net.minecraft.network.protocol.Packet#type()

  • Origin: common
  • Source: net/minecraft/network/protocol/Packet.java:10
  • Modifiers: ``
  • Return: PacketType<? extends Packet<T>>

คืออะไร

ดำเนินการ type ตาม implementation ของ Packet

ทำงานยังไง

ไม่มี body ใน source declaration นี้

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

Packet instance = ...;
PacketType<? extends Packet<T>> result = instance.type();

PacketFlow

  • Full name: net.minecraft.network.protocol.PacketFlow
  • Package: net.minecraft.network.protocol
  • Source: commonnet/minecraft/network/protocol/PacketFlow.java
  • Type: enum
  • Modifiers: public

net.minecraft.network.protocol.PacketFlow#getOpposite()

  • Origin: common
  • Source: net/minecraft/network/protocol/PacketFlow.java:13
  • Modifiers: public
  • Return: PacketFlow

คืออะไร

อ่านค่า Opposite

ทำงานยังไง

คืนค่า: this == CLIENTBOUND ? SERVERBOUND : CLIENTBOUND.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

PacketFlow instance = ...;
PacketFlow result = instance.getOpposite();

net.minecraft.network.protocol.PacketFlow#id()

  • Origin: common
  • Source: net/minecraft/network/protocol/PacketFlow.java:17
  • Modifiers: public
  • Return: String

คืออะไร

ดำเนินการ id ตาม implementation ของ PacketFlow

ทำงานยังไง

คืนค่า: this.id.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

PacketFlow instance = ...;
String result = instance.id();

PacketType

  • Full name: net.minecraft.network.protocol.PacketType
  • Package: net.minecraft.network.protocol
  • Source: commonnet/minecraft/network/protocol/PacketType.java
  • Type: record
  • Modifiers: public

net.minecraft.network.protocol.PacketType#toString()

  • Origin: common
  • Source: net/minecraft/network/protocol/PacketType.java:6
  • Modifiers: public
  • Return: String

คืออะไร

ดำเนินการ toString ตาม implementation ของ PacketType

ทำงานยังไง

เรียกต่อ: id(). คืนค่า: this.flow.id() + "/" + this.id.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

PacketType instance = ...;
String result = instance.toString();

PacketUtils

  • Full name: net.minecraft.network.protocol.PacketUtils
  • Package: net.minecraft.network.protocol
  • Source: commonnet/minecraft/network/protocol/PacketUtils.java
  • Type: class
  • Modifiers: public

net.minecraft.network.protocol.PacketUtils#ensureRunningOnSameThread(Packet<T>,T,BlockableEventLoop<?>)

  • Origin: common
  • Source: net/minecraft/network/protocol/PacketUtils.java:21
  • Modifiers: public static
  • Return: void

คืออะไร

ดำเนินการ ensureRunningOnSameThread ตาม implementation ของ PacketUtils

ทำงานยังไง

ตรวจเงื่อนไขด้วย if ; มีการจัดการ exception. เรียกต่อ: isSameThread(), executeIfPossible(), shouldHandleMessage(), handle(), getCause(), makeReportedException(), onPacketError(), debug().

Parameters

  • Packet<T> packet
  • T packetListener
  • BlockableEventLoop<?> blockableEventLoop

Throws

  • RunningOnDifferentThreadException

ตัวอย่างใช้งาน

Packet<T> packet = ...;
T packetListener = ...;
BlockableEventLoop<?> blockableEventLoop = ...;
PacketUtils.ensureRunningOnSameThread(packet, packetListener, blockableEventLoop);

net.minecraft.network.protocol.PacketUtils#ensureRunningOnSameThread(Packet<T>,T,ServerLevel)

  • Origin: common
  • Source: net/minecraft/network/protocol/PacketUtils.java:17
  • Modifiers: public static
  • Return: void

คืออะไร

ดำเนินการ ensureRunningOnSameThread ตาม implementation ของ PacketUtils

ทำงานยังไง

เรียกต่อ: getServer().

Parameters

  • Packet<T> packet
  • T packetListener
  • ServerLevel serverLevel

Throws

  • RunningOnDifferentThreadException

ตัวอย่างใช้งาน

Packet<T> packet = ...;
T packetListener = ...;
ServerLevel serverLevel = ...;
PacketUtils.ensureRunningOnSameThread(packet, packetListener, serverLevel);

net.minecraft.network.protocol.PacketUtils#fillCrashReport(CrashReport,T,Packet<T>)

  • Origin: common
  • Source: net/minecraft/network/protocol/PacketUtils.java:53
  • Modifiers: public static
  • Return: void

คืออะไร

ดำเนินการ fillCrashReport ตาม implementation ของ PacketUtils

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: addCategory(), setDetail(), type(), toString(), isTerminal(), isSkippable().

Parameters

  • CrashReport crashReport
  • T packetListener
  • Packet<T> packet

ตัวอย่างใช้งาน

CrashReport crashReport = ...;
T packetListener = ...;
Packet<T> packet = ...;
PacketUtils.fillCrashReport(crashReport, packetListener, packet);

net.minecraft.network.protocol.PacketUtils#makeReportedException(Exception,Packet<T>,T)

  • Origin: common
  • Source: net/minecraft/network/protocol/PacketUtils.java:42
  • Modifiers: public static
  • Return: ReportedException

คืออะไร

สร้าง Reported Exception

ทำงานยังไง

ตรวจเงื่อนไขด้วย if. เรียกต่อ: fillCrashReport(), getReport(), forThrowable(). สร้างออบเจ็กต์: ReportedException. มีจุด return อย่างน้อย 2 จุด.

Parameters

  • Exception exception
  • Packet<T> packet
  • T packetListener

ตัวอย่างใช้งาน

Exception exception = ...;
Packet<T> packet = ...;
T packetListener = ...;
ReportedException result = PacketUtils.makeReportedException(exception, packet, packetListener);

ProtocolCodecBuilder

  • Full name: net.minecraft.network.protocol.ProtocolCodecBuilder
  • Package: net.minecraft.network.protocol
  • Source: commonnet/minecraft/network/protocol/ProtocolCodecBuilder.java
  • Type: class
  • Modifiers: public

net.minecraft.network.protocol.ProtocolCodecBuilder#add(PacketType<T>,StreamCodec<? super B, T>)

  • Origin: common
  • Source: net/minecraft/network/protocol/ProtocolCodecBuilder.java:16
  • Modifiers: public
  • Return: ProtocolCodecBuilder<B, L>

คืออะไร

เพิ่ม add

ทำงานยังไง

ตรวจเงื่อนไขด้วย if ; มีการวนลูป. เรียกต่อ: flow(), name(). สร้างออบเจ็กต์: IllegalArgumentException. คืนค่า: this.

Parameters

  • PacketType<T> packetType
  • StreamCodec<? super B, T> streamCodec

ตัวอย่างใช้งาน

ProtocolCodecBuilder instance = ...;
PacketType<T> packetType = ...;
StreamCodec<? super B, T> streamCodec = ...;
ProtocolCodecBuilder<B, L> result = instance.add(packetType, streamCodec);

net.minecraft.network.protocol.ProtocolCodecBuilder#build()

  • Origin: common
  • Source: net/minecraft/network/protocol/ProtocolCodecBuilder.java:25
  • Modifiers: public
  • Return: StreamCodec<B, Packet<? super L>>

คืออะไร

สร้าง build

ทำงานยังไง

คืนค่า: this.dispatchBuilder.build().

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

ProtocolCodecBuilder instance = ...;
StreamCodec<B, Packet<? super L>> result = instance.build();

net.minecraft.network.protocol.ProtocolCodecBuilder#ProtocolCodecBuilder(PacketFlow)

  • Origin: common
  • Source: net/minecraft/network/protocol/ProtocolCodecBuilder.java:12
  • Modifiers: public
  • Kind: constructor

คืออะไร

สร้างออบเจ็กต์ ProtocolCodecBuilder ด้วยพารามิเตอร์ที่ระบุ

ทำงานยังไง

แก้ state: flow.

Parameters

  • PacketFlow packetFlow

ตัวอย่างใช้งาน

PacketFlow packetFlow = ...;
ProtocolCodecBuilder instance = new ProtocolCodecBuilder(packetFlow);

ProtocolInfoBuilder

  • Full name: net.minecraft.network.protocol.ProtocolInfoBuilder
  • Package: net.minecraft.network.protocol
  • Source: commonnet/minecraft/network/protocol/ProtocolInfoBuilder.java
  • Type: class
  • Modifiers: public

net.minecraft.network.protocol.ProtocolInfoBuilder#addPacket(PacketType<P>,StreamCodec<? super B, P>)

  • Origin: common
  • Source: net/minecraft/network/protocol/ProtocolInfoBuilder.java:28
  • Modifiers: public
  • Return: ProtocolInfoBuilder<T, B>

คืออะไร

เพิ่ม Packet

ทำงานยังไง

เรียกต่อ: add(). สร้างออบเจ็กต์: ProtocolInfoBuilder.CodecEntry<>. คืนค่า: this.

Parameters

  • PacketType<P> packetType
  • StreamCodec<? super B, P> streamCodec

ตัวอย่างใช้งาน

ProtocolInfoBuilder instance = ...;
PacketType<P> packetType = ...;
StreamCodec<? super B, P> streamCodec = ...;
ProtocolInfoBuilder<T, B> result = instance.addPacket(packetType, streamCodec);

net.minecraft.network.protocol.ProtocolInfoBuilder#build(Function<ByteBuf, B>)

  • Origin: common
  • Source: net/minecraft/network/protocol/ProtocolInfoBuilder.java:53
  • Modifiers: public
  • Return: ProtocolInfo<T>

คืออะไร

สร้าง build

ทำงานยังไง

เรียกต่อ: buildPacketCodec(). สร้างออบเจ็กต์: ProtocolInfoBuilder.Implementation<>. คืนค่า: new ProtocolInfoBuilder.Implementation<>(this.protocol, this.flow, this.buildPacketCodec(function, this.codecs), this.bundlerInfo).

Parameters

  • Function<ByteBuf, B> function

ตัวอย่างใช้งาน

ProtocolInfoBuilder instance = ...;
Function<ByteBuf, B> function = ...;
ProtocolInfo<T> result = instance.build(function);

net.minecraft.network.protocol.ProtocolInfoBuilder#buildUnbound()

  • Origin: common
  • Source: net/minecraft/network/protocol/ProtocolInfoBuilder.java:57
  • Modifiers: public
  • Return: ProtocolInfo.Unbound<T, B>

คืออะไร

สร้าง Unbound

ทำงานยังไง

มีการวนลูป. เรียกต่อ: copyOf(), bind(), buildPacketCodec(), id(), flow(), listPackets(), size(), get(). สร้างออบเจ็กต์: ProtocolInfoBuilder.Implementation<>. มีจุด return อย่างน้อย 2 จุด.

Parameters

  • ไม่มี

ตัวอย่างใช้งาน

ProtocolInfoBuilder instance = ...;
ProtocolInfo.Unbound<T, B> result = instance.buildUnbound();

net.minecraft.network.protocol.ProtocolInfoBuilder#clientboundProtocol(ConnectionProtocol,Consumer<ProtocolInfoBuilder<T, B>>)

  • Origin: common
  • Source: net/minecraft/network/protocol/ProtocolInfoBuilder.java:102
  • Modifiers: public static
  • Return: ProtocolInfo.Unbound<T, B>

คืออะไร

ดำเนินการ clientboundProtocol ตาม implementation ของ ProtocolInfoBuilder

ทำงานยังไง

เรียกต่อ: protocol(). คืนค่า: protocol(connectionProtocol, PacketFlow.CLIENTBOUND, consumer).

Parameters

  • ConnectionProtocol connectionProtocol
  • Consumer<ProtocolInfoBuilder<T, B>> consumer

ตัวอย่างใช้งาน

ConnectionProtocol connectionProtocol = ...;
Consumer<ProtocolInfoBuilder<T, B>> consumer = ...;
ProtocolInfo.Unbound<T, B> result = ProtocolInfoBuilder.clientboundProtocol(connectionProtocol, consumer);

net.minecraft.network.protocol.ProtocolInfoBuilder#ProtocolInfoBuilder(ConnectionProtocol,PacketFlow)

  • Origin: common
  • Source: net/minecraft/network/protocol/ProtocolInfoBuilder.java:23
  • Modifiers: public
  • Kind: constructor

คืออะไร

สร้างออบเจ็กต์ ProtocolInfoBuilder ด้วยพารามิเตอร์ที่ระบุ

ทำงานยังไง

แก้ state: protocol, flow.

Parameters

  • ConnectionProtocol connectionProtocol
  • PacketFlow packetFlow

ตัวอย่างใช้งาน

ConnectionProtocol connectionProtocol = ...;
PacketFlow packetFlow = ...;
ProtocolInfoBuilder instance = new ProtocolInfoBuilder(connectionProtocol, packetFlow);

net.minecraft.network.protocol.ProtocolInfoBuilder#serverboundProtocol(ConnectionProtocol,Consumer<ProtocolInfoBuilder<T, B>>)

  • Origin: common
  • Source: net/minecraft/network/protocol/ProtocolInfoBuilder.java:96
  • Modifiers: public static
  • Return: ProtocolInfo.Unbound<T, B>

คืออะไร

ดำเนินการ serverboundProtocol ตาม implementation ของ ProtocolInfoBuilder

ทำงานยังไง

เรียกต่อ: protocol(). คืนค่า: protocol(connectionProtocol, PacketFlow.SERVERBOUND, consumer).

Parameters

  • ConnectionProtocol connectionProtocol
  • Consumer<ProtocolInfoBuilder<T, B>> consumer

ตัวอย่างใช้งาน

ConnectionProtocol connectionProtocol = ...;
Consumer<ProtocolInfoBuilder<T, B>> consumer = ...;
ProtocolInfo.Unbound<T, B> result = ProtocolInfoBuilder.serverboundProtocol(connectionProtocol, consumer);

net.minecraft.network.protocol.ProtocolInfoBuilder#withBundlePacket(PacketType<P>,Function<Iterable<Packet<? super T>>, P>,D)

  • Origin: common
  • Source: net/minecraft/network/protocol/ProtocolInfoBuilder.java:33
  • Modifiers: public
  • Return: ProtocolInfoBuilder<T, B>

คืออะไร

ดำเนินการ withBundlePacket ตาม implementation ของ ProtocolInfoBuilder

ทำงานยังไง

แก้ state: bundlerInfo. เรียกต่อ: unit(), type(), add(), createForPacket(). สร้างออบเจ็กต์: ProtocolInfoBuilder.CodecEntry<>. คืนค่า: this.

Parameters

  • PacketType<P> packetType
  • Function<Iterable<Packet<? super T>>, P> function
  • D bundleDelimiterPacket

ตัวอย่างใช้งาน

ProtocolInfoBuilder instance = ...;
PacketType<P> packetType = ...;
Function<Iterable<Packet<? super T>>, P> function = ...;
D bundleDelimiterPacket = ...;
ProtocolInfoBuilder<T, B> result = instance.withBundlePacket(packetType, function, bundleDelimiterPacket);