net.minecraft.util.Vec3i Java Examples

The following examples show how to use net.minecraft.util.Vec3i. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnimationHandler.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #2
Source File: WrapperVec3i.java    From ClientBase with MIT License 4 votes vote down vote up
public WrapperVec3i(Vec3i var1) {
    this.real = var1;
}
 
Example #3
Source File: WrapperVec3i.java    From ClientBase with MIT License 4 votes vote down vote up
public Vec3i unwrap() {
    return this.real;
}
 
Example #4
Source File: WrapperVec3i.java    From ClientBase with MIT License 4 votes vote down vote up
public WrapperVec3i getNULL_VECTOR() {
    return new WrapperVec3i(Vec3i.NULL_VECTOR);
}
 
Example #5
Source File: AnimationHandler.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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;
}
 
Example #6
Source File: VectorConverter.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public Vector3D toNova(BlockPos pos) {
	return toNova((Vec3i) pos);
}
 
Example #7
Source File: VectorConverter.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
public Vector3D toNova(Vec3i pos) {
	return new Vector3D(pos.getX(), pos.getY(), pos.getZ());
}