BundlerInfo.java
net.minecraft.network.protocol.BundlerInfo
信息
- 全限定名:net.minecraft.network.protocol.BundlerInfo
- 类型:public interface
- 包:net.minecraft.network.protocol
- 源码路径:src/main/java/net/minecraft/network/protocol/BundlerInfo.java
- 起始行号:L11
- 职责:
TODO
字段/常量
BUNDLE_SIZE_LIMIT- 类型:
int - 修饰符:
package-private - 源码定位:
L12 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.network.protocol.BundlerInfo.Bundler- 类型:
interface - 修饰符:
public - 源码定位:
L60 - 说明:
TODO
- 类型:
构造器
- 无
方法
下面的方法块按源码顺序生成。
static <T extends PacketListener,P extends BundlePacket<?super T>> BundlerInfo createForPacket(PacketType<P> bundlePacketType, Function<Iterable<Packet<?super T>>,P> constructor, BundleDelimiterPacket<?super T> delimiterPacket) @ L14
- 方法名:createForPacket
- 源码定位:L14
- 返回类型:<T extends PacketListener,P extends BundlePacket<?super T>> BundlerInfo
- 修饰符:static
参数:
- bundlePacketType: PacketType
- constructor: Function<Iterable<Packet<?super T>>,P>
- delimiterPacket: BundleDelimiterPacket<?super T>
说明:
TODO
void unbundlePacket(Packet<?> packet, Consumer<Packet<?>> output) @ L56
- 方法名:unbundlePacket
- 源码定位:L56
- 返回类型:void
- 修饰符:package-private
参数:
- packet: Packet<?>
- output: Consumer<Packet<?>>
说明:
TODO
BundlerInfo.Bundler startPacketBundling(Packet<?> packet) @ L58
- 方法名:startPacketBundling
- 源码定位:L58
- 返回类型:BundlerInfo.Bundler
- 修饰符:package-private
参数:
- packet: Packet<?>
说明:
TODO
代码
public interface BundlerInfo {
int BUNDLE_SIZE_LIMIT = 4096;
static <T extends PacketListener, P extends BundlePacket<? super T>> BundlerInfo createForPacket(
PacketType<P> bundlePacketType, Function<Iterable<Packet<? super T>>, P> constructor, BundleDelimiterPacket<? super T> delimiterPacket
) {
return new BundlerInfo() {
@Override
public void unbundlePacket(Packet<?> packet, Consumer<Packet<?>> output) {
if (packet.type() == bundlePacketType) {
P bundlerPacket = (P)packet;
output.accept(delimiterPacket);
bundlerPacket.subPackets().forEach(output);
output.accept(delimiterPacket);
} else {
output.accept(packet);
}
}
@Override
public BundlerInfo.@Nullable Bundler startPacketBundling(Packet<?> packet) {
return packet == delimiterPacket ? new BundlerInfo.Bundler() {
private final List<Packet<? super T>> bundlePackets;
{
this.bundlePackets = new ArrayList<>();
}
@Override
public @Nullable Packet<?> addPacket(Packet<?> packet) {
if (packet == delimiterPacket) {
return constructor.apply(this.bundlePackets);
} else if (this.bundlePackets.size() >= 4096) {
throw new IllegalStateException("Too many packets in a bundle");
} else {
this.bundlePackets.add((Packet<? super T>)packet);
return null;
}
}
} : null;
}
};
}
void unbundlePacket(Packet<?> packet, Consumer<Packet<?>> output);
BundlerInfo.@Nullable Bundler startPacketBundling(Packet<?> packet);
public interface Bundler {
@Nullable Packet<?> addPacket(Packet<?> packet);
}
}引用的其他类
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置: