下面列出了怎么用net.minecraft.util.Vec3i的API类实例代码及写法,或者点击链接到github查看源代码。
public void setPosition(RenderChunk rc, BlockPos bp) {
if (!ChunkAnimatorConfig.enabled) return;
if (Minecraft.getMinecraft().thePlayer != null) {
boolean flag = true;
BlockPos zeroedPlayerPosition = Minecraft.getMinecraft().thePlayer.getPosition();
zeroedPlayerPosition = zeroedPlayerPosition.add(0, -zeroedPlayerPosition.getY(), 0);
BlockPos zeroedCenteredChunkPos = bp.add(8, -bp.getY(), 8);
if (ChunkAnimatorConfig.disableAroundPlayer) {
flag = zeroedPlayerPosition.distanceSq(zeroedCenteredChunkPos) > (64 * 64);
}
if (flag) {
EnumFacing chunkFacing = null;
if (ChunkAnimatorConfig.mode.equals("From sides")) {
Vec3i dif = zeroedPlayerPosition.subtract(zeroedCenteredChunkPos);
int difX = Math.abs(dif.getX());
int difZ = Math.abs(dif.getZ());
chunkFacing = getFacing(dif, difX, difZ);
}
AnimationData animationData = new AnimationData(-1L, chunkFacing);
timeStamps.put(rc, animationData);
}
}
}
public WrapperVec3i(Vec3i var1) {
this.real = var1;
}
public Vec3i unwrap() {
return this.real;
}
public WrapperVec3i getNULL_VECTOR() {
return new WrapperVec3i(Vec3i.NULL_VECTOR);
}
@NotNull
private EnumFacing getFacing(Vec3i dif, int difX, int difZ) {
return difX > difZ ? dif.getX() > 0 ? EnumFacing.EAST : EnumFacing.WEST : dif.getZ() > 0 ? EnumFacing.SOUTH : EnumFacing.NORTH;
}
@Override
public Vector3D toNova(BlockPos pos) {
return toNova((Vec3i) pos);
}
public Vector3D toNova(Vec3i pos) {
return new Vector3D(pos.getX(), pos.getY(), pos.getZ());
}