本文整理匯總了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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}