HiddenByteBuf.java

net.minecraft.network.HiddenByteBuf

信息

  • 全限定名:net.minecraft.network.HiddenByteBuf
  • 类型:public record
  • 包:net.minecraft.network
  • 源码路径:src/main/java/net/minecraft/network/HiddenByteBuf.java
  • 起始行号:L7
  • 实现:ReferenceCounted
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

public HiddenByteBuf(ByteBuf contents) @ L8

  • 构造器名:HiddenByteBuf
  • 源码定位:L8
  • 修饰符:public

参数:

  • contents: ByteBuf

说明:

TODO

方法

下面的方法块按源码顺序生成。

public static Object pack(Object msg) @ L12

  • 方法名:pack
  • 源码定位:L12
  • 返回类型:Object
  • 修饰符:public static

参数:

  • msg: Object

说明:

TODO

public static Object unpack(Object msg) @ L16

  • 方法名:unpack
  • 源码定位:L16
  • 返回类型:Object
  • 修饰符:public static

参数:

  • msg: Object

说明:

TODO

public int refCnt() @ L20

  • 方法名:refCnt
  • 源码定位:L20
  • 返回类型:int
  • 修饰符:public

参数:

说明:

TODO

public HiddenByteBuf retain() @ L25

  • 方法名:retain
  • 源码定位:L25
  • 返回类型:HiddenByteBuf
  • 修饰符:public

参数:

说明:

TODO

public HiddenByteBuf retain(int increment) @ L30

  • 方法名:retain
  • 源码定位:L30
  • 返回类型:HiddenByteBuf
  • 修饰符:public

参数:

  • increment: int

说明:

TODO

public HiddenByteBuf touch() @ L35

  • 方法名:touch
  • 源码定位:L35
  • 返回类型:HiddenByteBuf
  • 修饰符:public

参数:

说明:

TODO

public HiddenByteBuf touch(Object hint) @ L40

  • 方法名:touch
  • 源码定位:L40
  • 返回类型:HiddenByteBuf
  • 修饰符:public

参数:

  • hint: Object

说明:

TODO

public boolean release() @ L45

  • 方法名:release
  • 源码定位:L45
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public boolean release(int decrement) @ L50

  • 方法名:release
  • 源码定位:L50
  • 返回类型:boolean
  • 修饰符:public

参数:

  • decrement: int

说明:

TODO

代码

public record HiddenByteBuf(ByteBuf contents) implements ReferenceCounted {
    public HiddenByteBuf(ByteBuf contents) {
        this.contents = ByteBufUtil.ensureAccessible(contents);
    }
 
    public static Object pack(Object msg) {
        return msg instanceof ByteBuf buf ? new HiddenByteBuf(buf) : msg;
    }
 
    public static Object unpack(Object msg) {
        return msg instanceof HiddenByteBuf buf ? ByteBufUtil.ensureAccessible(buf.contents) : msg;
    }
 
    @Override
    public int refCnt() {
        return this.contents.refCnt();
    }
 
    public HiddenByteBuf retain() {
        this.contents.retain();
        return this;
    }
 
    public HiddenByteBuf retain(int increment) {
        this.contents.retain(increment);
        return this;
    }
 
    public HiddenByteBuf touch() {
        this.contents.touch();
        return this;
    }
 
    public HiddenByteBuf touch(Object hint) {
        this.contents.touch(hint);
        return this;
    }
 
    @Override
    public boolean release() {
        return this.contents.release();
    }
 
    @Override
    public boolean release(int decrement) {
        return this.contents.release(decrement);
    }
}

引用的其他类