BlockDestructionProgress.java

net.minecraft.server.level.BlockDestructionProgress

信息

  • 全限定名:net.minecraft.server.level.BlockDestructionProgress
  • 类型:public class
  • 包:net.minecraft.server.level
  • 源码路径:src/main/java/net/minecraft/server/level/BlockDestructionProgress.java
  • 起始行号:L5
  • 实现:Comparable
  • 职责:

    TODO

字段/常量

  • id

    • 类型: int
    • 修饰符: private final
    • 源码定位: L6
    • 说明:

      TODO

  • pos

    • 类型: BlockPos
    • 修饰符: private final
    • 源码定位: L7
    • 说明:

      TODO

  • progress

    • 类型: int
    • 修饰符: private
    • 源码定位: L8
    • 说明:

      TODO

  • updatedRenderTick

    • 类型: int
    • 修饰符: private
    • 源码定位: L9
    • 说明:

      TODO

内部类/嵌套类型

构造器

public BlockDestructionProgress(int id, BlockPos pos) @ L11

  • 构造器名:BlockDestructionProgress
  • 源码定位:L11
  • 修饰符:public

参数:

  • id: int
  • pos: BlockPos

说明:

TODO

方法

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

public int getId() @ L16

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

参数:

说明:

TODO

public BlockPos getPos() @ L20

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

参数:

说明:

TODO

public void setProgress(int progress) @ L24

  • 方法名:setProgress
  • 源码定位:L24
  • 返回类型:void
  • 修饰符:public

参数:

  • progress: int

说明:

TODO

public int getProgress() @ L32

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

参数:

说明:

TODO

public void updateTick(int tick) @ L36

  • 方法名:updateTick
  • 源码定位:L36
  • 返回类型:void
  • 修饰符:public

参数:

  • tick: int

说明:

TODO

public int getUpdatedRenderTick() @ L40

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

参数:

说明:

TODO

public boolean equals(Object o) @ L44

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

参数:

  • o: Object

说明:

TODO

public int hashCode() @ L56

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

参数:

说明:

TODO

public int compareTo(BlockDestructionProgress o) @ L61

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

参数:

  • o: BlockDestructionProgress

说明:

TODO

代码

public class BlockDestructionProgress implements Comparable<BlockDestructionProgress> {
    private final int id;
    private final BlockPos pos;
    private int progress;
    private int updatedRenderTick;
 
    public BlockDestructionProgress(int id, BlockPos pos) {
        this.id = id;
        this.pos = pos;
    }
 
    public int getId() {
        return this.id;
    }
 
    public BlockPos getPos() {
        return this.pos;
    }
 
    public void setProgress(int progress) {
        if (progress > 10) {
            progress = 10;
        }
 
        this.progress = progress;
    }
 
    public int getProgress() {
        return this.progress;
    }
 
    public void updateTick(int tick) {
        this.updatedRenderTick = tick;
    }
 
    public int getUpdatedRenderTick() {
        return this.updatedRenderTick;
    }
 
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        } else if (o != null && this.getClass() == o.getClass()) {
            BlockDestructionProgress that = (BlockDestructionProgress)o;
            return this.id == that.id;
        } else {
            return false;
        }
    }
 
    @Override
    public int hashCode() {
        return Integer.hashCode(this.id);
    }
 
    public int compareTo(BlockDestructionProgress o) {
        return this.progress != o.progress ? Integer.compare(this.progress, o.progress) : Integer.compare(this.id, o.id);
    }
}

引用的其他类

  • BlockPos
    • 引用位置: 参数/字段/返回值