當前位置: 首頁>>代碼示例>>Java>>正文


Java WorldChunkManager.findBiomePosition方法代碼示例

本文整理匯總了Java中net.minecraft.world.biome.WorldChunkManager.findBiomePosition方法的典型用法代碼示例。如果您正苦於以下問題:Java WorldChunkManager.findBiomePosition方法的具體用法?Java WorldChunkManager.findBiomePosition怎麽用?Java WorldChunkManager.findBiomePosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.world.biome.WorldChunkManager的用法示例。


在下文中一共展示了WorldChunkManager.findBiomePosition方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createSpawnPosition

import net.minecraft.world.biome.WorldChunkManager; //導入方法依賴的package包/類
/**
 * creates a spawn position at random within 256 blocks of 0,0
 */
private void createSpawnPosition(WorldSettings p_73052_1_)
{
    if (!this.provider.canRespawnHere())
    {
        this.worldInfo.setSpawn(BlockPos.ORIGIN.up(this.provider.getAverageGroundLevel()));
    }
    else if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD)
    {
        this.worldInfo.setSpawn(BlockPos.ORIGIN.up());
    }
    else
    {
        this.findingSpawnPoint = true;
        WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager();
        List<BiomeGenBase> list = worldchunkmanager.getBiomesToSpawnIn();
        Random random = new Random(this.getSeed());
        BlockPos blockpos = worldchunkmanager.findBiomePosition(0, 0, 256, list, random);
        int i = 0;
        int j = this.provider.getAverageGroundLevel();
        int k = 0;

        if (blockpos != null)
        {
            i = blockpos.getX();
            k = blockpos.getZ();
        }
        else
        {
            logger.warn("Unable to find spawn biome");
        }

        int l = 0;

        while (!this.provider.canCoordinateBeSpawn(i, k))
        {
            i += random.nextInt(64) - random.nextInt(64);
            k += random.nextInt(64) - random.nextInt(64);
            ++l;

            if (l == 1000)
            {
                break;
            }
        }

        this.worldInfo.setSpawn(new BlockPos(i, j, k));
        this.findingSpawnPoint = false;

        if (p_73052_1_.isBonusChestEnabled())
        {
            this.createBonusChest();
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:58,代碼來源:WorldServer.java

示例2: createSpawnPosition

import net.minecraft.world.biome.WorldChunkManager; //導入方法依賴的package包/類
/**
 * creates a spawn position at random within 256 blocks of 0,0
 */
protected void createSpawnPosition(WorldSettings p_73052_1_) {
	if (!this.provider.canRespawnHere()) {
		this.worldInfo.setSpawnPosition(0, this.provider.getAverageGroundLevel(), 0);
	} else {
		if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_))
			return;
		this.findingSpawnPoint = true;
		WorldChunkManager worldchunkmanager = this.provider.worldChunkMgr;
		List<?> list = worldchunkmanager.getBiomesToSpawnIn();
		Random random = new Random(this.getSeed());
		ChunkPosition chunkposition = worldchunkmanager.findBiomePosition(0, 0, 256, list, random);
		int i = 0;
		int j = this.provider.getAverageGroundLevel();
		int k = 0;

		if (chunkposition != null) {
			i = chunkposition.chunkPosX;
			k = chunkposition.chunkPosZ;
		} else {
			logger.warn("Unable to find spawn biome");
		}

		int l = 0;

		while (!this.provider.canCoordinateBeSpawn(i, k)) {
			i += random.nextInt(64) - random.nextInt(64);
			k += random.nextInt(64) - random.nextInt(64);
			++l;

			if (l == 1000) {
				break;
			}
		}

		this.worldInfo.setSpawnPosition(i, j, k);
		this.findingSpawnPoint = false;

		if (p_73052_1_.isBonusChestEnabled()) {
			this.createBonusChest();
		}
	}
}
 
開發者ID:OreCruncher,項目名稱:Jiffy,代碼行數:46,代碼來源:WorldServer.java

示例3: createSpawnPosition

import net.minecraft.world.biome.WorldChunkManager; //導入方法依賴的package包/類
protected void createSpawnPosition(WorldSettings p_73052_1_)
{
    if (!this.provider.canRespawnHere())
    {
        this.worldInfo.setSpawnPosition(0, this.provider.getAverageGroundLevel(), 0);
    }
    else
    {
        this.findingSpawnPoint = true;
        WorldChunkManager worldchunkmanager = this.provider.worldChunkMgr;
        List list = worldchunkmanager.getBiomesToSpawnIn();
        Random random = new Random(this.getSeed());
        ChunkPosition chunkposition = worldchunkmanager.findBiomePosition(0, 0, 256, list, random);
        int i = 0;
        int j = this.provider.getAverageGroundLevel();
        int k = 0;

        // CraftBukkit start
        if (this.generator != null)
        {
            Random rand = new Random(this.getSeed());
            org.bukkit.Location spawn = this.generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);

            if (spawn != null)
            {
                if (spawn.getWorld() != ((WorldServer) this).getWorld())
                {
                    throw new IllegalStateException("Cannot set spawn point for " + this.worldInfo.getWorldName() + " to be in another world (" + spawn.getWorld().getName() + ")");
                }
                else
                {
                    this.worldInfo.setSpawnPosition(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
                    this.findingSpawnPoint = false;
                    return;
                }
            }
        }

        // CraftBukkit end

        if (chunkposition != null)
        {
            i = chunkposition.chunkPosX;
            k = chunkposition.chunkPosZ;
        }
        else
        {
            logger.warn("Unable to find spawn biome");
        }

        int l = 0;

        while (!this.provider.canCoordinateBeSpawn(i, k))
        {
            i += random.nextInt(64) - random.nextInt(64);
            k += random.nextInt(64) - random.nextInt(64);
            ++l;

            if (l == 1000)
            {
                break;
            }
        }

        this.worldInfo.setSpawnPosition(i, j, k);
        this.findingSpawnPoint = false;

        if (p_73052_1_.isBonusChestEnabled())
        {
            this.createBonusChest();
        }
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:74,代碼來源:WorldServer.java

示例4: createSpawnPosition

import net.minecraft.world.biome.WorldChunkManager; //導入方法依賴的package包/類
protected void createSpawnPosition(WorldSettings p_73052_1_)
{
    if (!this.provider.canRespawnHere())
    {
        this.worldInfo.setSpawnPosition(0, this.provider.getAverageGroundLevel(), 0);
    }
    else
    {
        this.findingSpawnPoint = true;
        WorldChunkManager worldchunkmanager = this.provider.worldChunkMgr;
        List list = worldchunkmanager.getBiomesToSpawnIn();
        Random random = new Random(this.getSeed());
        ChunkPosition chunkposition = worldchunkmanager.findBiomePosition(0, 0, 256, list, random);
        int i = 0;
        int j = this.provider.getAverageGroundLevel();
        int k = 0;

        if (chunkposition != null)
        {
            i = chunkposition.chunkPosX;
            k = chunkposition.chunkPosZ;
        }
        else
        {
            logger.warn("Unable to find spawn biome");
        }

        int l = 0;

        while (!this.provider.canCoordinateBeSpawn(i, k))
        {
            i += random.nextInt(64) - random.nextInt(64);
            k += random.nextInt(64) - random.nextInt(64);
            ++l;

            if (l == 1000)
            {
                break;
            }
        }

        this.worldInfo.setSpawnPosition(i, j, k);
        this.findingSpawnPoint = false;

        if (p_73052_1_.isBonusChestEnabled())
        {
            this.createBonusChest();
        }
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:51,代碼來源:WorldServer.java

示例5: createSpawnPosition

import net.minecraft.world.biome.WorldChunkManager; //導入方法依賴的package包/類
/**
 * creates a spawn position at random within 256 blocks of 0,0
 */
protected void createSpawnPosition(WorldSettings par1WorldSettings)
{
    if (!this.provider.canRespawnHere())
    {
        this.worldInfo.setSpawnPosition(0, this.provider.getAverageGroundLevel(), 0);
    }
    else
    {
        this.findingSpawnPoint = true;
        WorldChunkManager worldchunkmanager = this.provider.worldChunkMgr;
        List list = worldchunkmanager.getBiomesToSpawnIn();
        Random random = new Random(this.getSeed());
        ChunkPosition chunkposition = worldchunkmanager.findBiomePosition(0, 0, 256, list, random);
        int i = 0;
        int j = this.provider.getAverageGroundLevel();
        int k = 0;

        if (chunkposition != null)
        {
            i = chunkposition.x;
            k = chunkposition.z;
        }
        else
        {
            this.getWorldLogAgent().logWarning("Unable to find spawn biome");
        }

        int l = 0;

        while (!this.provider.canCoordinateBeSpawn(i, k))
        {
            i += random.nextInt(64) - random.nextInt(64);
            k += random.nextInt(64) - random.nextInt(64);
            ++l;

            if (l == 1000)
            {
                break;
            }
        }

        this.worldInfo.setSpawnPosition(i, j, k);
        this.findingSpawnPoint = false;

        if (par1WorldSettings.isBonusChestEnabled())
        {
            this.createBonusChest();
        }
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:54,代碼來源:WorldServer.java


注:本文中的net.minecraft.world.biome.WorldChunkManager.findBiomePosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。