TranslucencyPointOfView.java

net.minecraft.client.renderer.chunk.TranslucencyPointOfView

信息

  • 全限定名:net.minecraft.client.renderer.chunk.TranslucencyPointOfView
  • 类型:public final class
  • 包:net.minecraft.client.renderer.chunk
  • 源码路径:src/main/java/net/minecraft/client/renderer/chunk/TranslucencyPointOfView.java
  • 起始行号:L10
  • 职责:

    TODO

字段/常量

  • x

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

      TODO

  • y

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

      TODO

  • z

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

      TODO

内部类/嵌套类型

构造器

方法

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

public static TranslucencyPointOfView of(Vec3 cameraPos, long sectionNode) @ L15

  • 方法名:of
  • 源码定位:L15
  • 返回类型:TranslucencyPointOfView
  • 修饰符:public static

参数:

  • cameraPos: Vec3
  • sectionNode: long

说明:

TODO

public TranslucencyPointOfView set(Vec3 cameraPos, long sectionPos) @ L19

  • 方法名:set
  • 源码定位:L19
  • 返回类型:TranslucencyPointOfView
  • 修饰符:public

参数:

  • cameraPos: Vec3
  • sectionPos: long

说明:

TODO

private static int getCoordinate(double cameraCoordinate, int section) @ L26

  • 方法名:getCoordinate
  • 源码定位:L26
  • 返回类型:int
  • 修饰符:private static

参数:

  • cameraCoordinate: double
  • section: int

说明:

TODO

public boolean isAxisAligned() @ L31

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

参数:

说明:

TODO

public boolean equals(Object other) @ L35

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

参数:

  • other: Object

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public final class TranslucencyPointOfView {
    private int x;
    private int y;
    private int z;
 
    public static TranslucencyPointOfView of(Vec3 cameraPos, long sectionNode) {
        return new TranslucencyPointOfView().set(cameraPos, sectionNode);
    }
 
    public TranslucencyPointOfView set(Vec3 cameraPos, long sectionPos) {
        this.x = getCoordinate(cameraPos.x(), SectionPos.x(sectionPos));
        this.y = getCoordinate(cameraPos.y(), SectionPos.y(sectionPos));
        this.z = getCoordinate(cameraPos.z(), SectionPos.z(sectionPos));
        return this;
    }
 
    private static int getCoordinate(double cameraCoordinate, int section) {
        int relativeSection = SectionPos.blockToSectionCoord(cameraCoordinate) - section;
        return Mth.clamp(relativeSection, -1, 1);
    }
 
    public boolean isAxisAligned() {
        return this.x == 0 || this.y == 0 || this.z == 0;
    }
 
    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        } else {
            return !(other instanceof TranslucencyPointOfView otherPerspective)
                ? false
                : this.x == otherPerspective.x && this.y == otherPerspective.y && this.z == otherPerspective.z;
        }
    }
}

引用的其他类

  • SectionPos

    • 引用位置: 方法调用
    • 关联成员: SectionPos.blockToSectionCoord(), SectionPos.x(), SectionPos.y(), SectionPos.z()
  • Mth

    • 引用位置: 方法调用
    • 关联成员: Mth.clamp()
  • Vec3

    • 引用位置: 参数