Search in sources :

Example 41 with ChunkPos

use of net.minecraft.util.math.ChunkPos in project MorePlanets by SteveKunG.

the class MapGenNibiruStronghold method getNearestStructurePos.

@Override
public BlockPos getNearestStructurePos(World world, BlockPos pos, boolean findUnexplored) {
    if (!this.ranBiomeCheck) {
        this.generatePositions();
        this.ranBiomeCheck = true;
    }
    BlockPos blockpos = null;
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(0, 0, 0);
    double d0 = Double.MAX_VALUE;
    for (ChunkPos chunkpos : this.structureCoords) {
        blockpos$mutableblockpos.setPos((chunkpos.x << 4) + 8, 32, (chunkpos.z << 4) + 8);
        double d1 = blockpos$mutableblockpos.distanceSq(pos);
        if (blockpos == null) {
            blockpos = new BlockPos(blockpos$mutableblockpos);
            d0 = d1;
        } else if (d1 < d0) {
            blockpos = new BlockPos(blockpos$mutableblockpos);
            d0 = d1;
        }
    }
    return blockpos;
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) ChunkPos(net.minecraft.util.math.ChunkPos)

Aggregations

ChunkPos (net.minecraft.util.math.ChunkPos)41 BlockPos (net.minecraft.util.math.BlockPos)15 Biome (net.minecraft.world.biome.Biome)7 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)6 NBTTagList (net.minecraft.nbt.NBTTagList)6 Random (java.util.Random)5 WorldServer (net.minecraft.world.WorldServer)5 Structure (ivorius.reccomplex.world.gen.feature.structure.Structure)3 World (net.minecraft.world.World)3 WorldGenLiquidLakes (stevekung.mods.moreplanets.util.world.gen.feature.WorldGenLiquidLakes)3 WorldGenSpaceDungeons (stevekung.mods.moreplanets.util.world.gen.feature.WorldGenSpaceDungeons)3 StructureSpawnContext (ivorius.reccomplex.world.gen.feature.structure.context.StructureSpawnContext)2 NaturalGeneration (ivorius.reccomplex.world.gen.feature.structure.generic.generation.NaturalGeneration)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 ItemStack (net.minecraft.item.ItemStack)2 SPacketEntityEffect (net.minecraft.network.play.server.SPacketEntityEffect)2 SPacketRespawn (net.minecraft.network.play.server.SPacketRespawn)2 SPacketSetExperience (net.minecraft.network.play.server.SPacketSetExperience)2