本文整理汇总了Java中net.minecraft.world.World.getBiomeGenForCoords方法的典型用法代码示例。如果您正苦于以下问题:Java World.getBiomeGenForCoords方法的具体用法?Java World.getBiomeGenForCoords怎么用?Java World.getBiomeGenForCoords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.getBiomeGenForCoords方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Start
import net.minecraft.world.World; //导入方法依赖的package包/类
public Start(World worldIn, Random p_i2060_2_, int p_i2060_3_, int p_i2060_4_)
{
super(p_i2060_3_, p_i2060_4_);
BiomeGenBase biomegenbase = worldIn.getBiomeGenForCoords(new BlockPos(p_i2060_3_ * 16 + 8, 0, p_i2060_4_ * 16 + 8));
if (biomegenbase != BiomeGenBase.jungle && biomegenbase != BiomeGenBase.jungleHills)
{
if (biomegenbase == BiomeGenBase.swampland)
{
ComponentScatteredFeaturePieces.SwampHut componentscatteredfeaturepieces$swamphut = new ComponentScatteredFeaturePieces.SwampHut(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16);
this.components.add(componentscatteredfeaturepieces$swamphut);
}
else if (biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills)
{
ComponentScatteredFeaturePieces.DesertPyramid componentscatteredfeaturepieces$desertpyramid = new ComponentScatteredFeaturePieces.DesertPyramid(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16);
this.components.add(componentscatteredfeaturepieces$desertpyramid);
}
}
else
{
ComponentScatteredFeaturePieces.JunglePyramid componentscatteredfeaturepieces$junglepyramid = new ComponentScatteredFeaturePieces.JunglePyramid(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16);
this.components.add(componentscatteredfeaturepieces$junglepyramid);
}
this.updateBoundingBox();
}
示例2: removeStone
import net.minecraft.world.World; //导入方法依赖的package包/类
private void removeStone(World world, Random random, int x, int z) {
int id = world.getBiomeGenForCoords(x, z).biomeID;
Block block = Blocks.stone;
if(id == 35 || id == 163 || id == 29 || id == 157 || id == 6 || id == 134 || id == 160 || id == 161 || id == 32 || id == 33) {
block = Granite;
} else if(id == 36 || id == 164 || id == 16 || id == 14 || id == 15 || id == 0 || id == 24 || id == 26) {
block = Basalt;
} else if(id == 2 || id == 1 || id == 7 || id == 129 || id == 5 || id == 30 || id == 11) {
block = Limestone;
} else if(id == 130 || id == 17 || id == 21 || id == 149 || id == 23 || id == 151 || id == 22 || id == 133 || id == 155 || id == 19 || id == 31 || id == 158 || id == 27) {
block = Shale;
} else if(id == 37 || id == 165 || id == 132 || id == 4 || id == 3 || id == 131 || id == 34 || id == 162 || id == 28 || id == 156 || id == 25) {
block = Slate;
} else if(id == 39 || id == 167 || id == 38 || id == 166 || id == 18 || id == 13 || id == 12 || id == 140) {
block = Gneiss;
} else {
FMLLog.log(Level.ERROR, Technical.modName + ": TechnicalWorldGenerator could not find stone type for " + world.getBiomeGenForCoords(x, z).biomeName + " (id " + id + "). Please report this to the mod author(s)");
}
for(int y = 0; y < world.getActualHeight(); y++) {
if(world.getBlock(x, y, z) == Blocks.stone)
world.setBlock(x, y, z, block, 0, 0);
}
}
示例3: entityLoaded
import net.minecraft.world.World; //导入方法依赖的package包/类
public static void entityLoaded(Entity p_entityLoaded_0_, World p_entityLoaded_1_)
{
if (p_entityLoaded_0_ instanceof EntityLiving)
{
if (p_entityLoaded_1_ != null)
{
EntityLiving entityliving = (EntityLiving)p_entityLoaded_0_;
entityliving.spawnPosition = entityliving.getPosition();
entityliving.spawnBiome = p_entityLoaded_1_.getBiomeGenForCoords(entityliving.spawnPosition);
WorldServer worldserver = Config.getWorldServer();
if (worldserver != null)
{
Entity entity = worldserver.getEntityByID(p_entityLoaded_0_.getEntityId());
if (entity instanceof EntityLiving)
{
EntityLiving entityliving1 = (EntityLiving)entity;
UUID uuid = entityliving1.getUniqueID();
long i = uuid.getLeastSignificantBits();
int j = (int)(i & 2147483647L);
entityliving.randomMobsId = j;
}
}
}
}
}
示例4: get
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
@Callback
public Object[] get(Context context, Arguments args, World worldIn, TileEntitySensor teIn) {
if (args.checkString(0).equalsIgnoreCase("biome")) {
return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).biomeName };
} else if (args.checkString(0).equalsIgnoreCase("lightlevel")) {
return new Object[] { worldIn.getBlockLightValue((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.yCoord + rangeLimit(rangeLimit(args.optInteger(1, 0)))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))) };
} else if (args.checkString(0).equalsIgnoreCase("raining")) {
return new Object[] { worldIn.isRaining() };
} else if (args.checkString(0).equalsIgnoreCase("thundering")) {
return new Object[] { worldIn.isThundering() };
} else if (args.checkString(0).equalsIgnoreCase("daytime")) {
return new Object[] { worldIn.isDaytime() };
} else if (args.checkString(0).equalsIgnoreCase("moonphase")) {
return new Object[] { worldIn.getCurrentMoonPhaseFactor() };
} else if (args.checkString(0).equalsIgnoreCase("celestialangle")) {
return new Object[] { worldIn.getCelestialAngle(1.0F)};
} else if (args.checkString(0).equalsIgnoreCase("dimension")) {
return new Object[] { worldIn.getWorldInfo().getVanillaDimension()};
} else if (args.checkString(0).equalsIgnoreCase("temperature") || args.checkString(0).equalsIgnoreCase("temp")) {
return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).temperature};
} else if (args.checkString(0).equalsIgnoreCase("highhumidity")) {
return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).isHighHumidity()};
} else if (args.checkString(0).equalsIgnoreCase("humidity")) {
return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).rainfall};
} else if (args.checkString(0).equalsIgnoreCase("worldseed")) {
return new Object[] { worldIn.getSeed()};
}
return new Object[] { "No method passed, or not found" };
}
示例5: onBlockActivated
import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
if (state.getValue(PART) != BlockBed.EnumPartType.HEAD)
{
pos = pos.offset((EnumFacing)state.getValue(FACING));
state = worldIn.getBlockState(pos);
if (state.getBlock() != this)
{
return true;
}
}
if (worldIn.provider.canRespawnHere() && worldIn.getBiomeGenForCoords(pos) != BiomeGenBase.hell)
{
if (((Boolean)state.getValue(OCCUPIED)).booleanValue())
{
EntityPlayer entityplayer = this.getPlayerInBed(worldIn, pos);
if (entityplayer != null)
{
playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.occupied", new Object[0]));
return true;
}
state = state.withProperty(OCCUPIED, Boolean.valueOf(false));
worldIn.setBlockState(pos, state, 4);
}
EntityPlayer.EnumStatus entityplayer$enumstatus = playerIn.trySleep(pos);
if (entityplayer$enumstatus == EntityPlayer.EnumStatus.OK)
{
state = state.withProperty(OCCUPIED, Boolean.valueOf(true));
worldIn.setBlockState(pos, state, 4);
return true;
}
else
{
if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW)
{
playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0]));
}
else if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_SAFE)
{
playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0]));
}
return true;
}
}
else
{
worldIn.setBlockToAir(pos);
BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());
if (worldIn.getBlockState(blockpos).getBlock() == this)
{
worldIn.setBlockToAir(blockpos);
}
worldIn.newExplosion((Entity)null, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 5.0F, true, true);
return true;
}
}
}
示例6: addRainParticles
import net.minecraft.world.World; //导入方法依赖的package包/类
private void addRainParticles()
{
float f = this.mc.theWorld.getRainStrength(1.0F);
if (!this.mc.gameSettings.fancyGraphics)
{
f /= 2.0F;
}
if (f != 0.0F)
{
this.random.setSeed((long)this.rendererUpdateCount * 312987231L);
Entity entity = this.mc.getRenderViewEntity();
World world = this.mc.theWorld;
BlockPos blockpos = new BlockPos(entity);
int i = 10;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int j = 0;
int k = (int)(100.0F * f * f);
if (this.mc.gameSettings.particleSetting == 1)
{
k >>= 1;
}
else if (this.mc.gameSettings.particleSetting == 2)
{
k = 0;
}
for (int l = 0; l < k; ++l)
{
BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.random.nextInt(i) - this.random.nextInt(i), 0, this.random.nextInt(i) - this.random.nextInt(i)));
BiomeGenBase biomegenbase = world.getBiomeGenForCoords(blockpos1);
BlockPos blockpos2 = blockpos1.down();
Block block = world.getBlockState(blockpos2).getBlock();
if (blockpos1.getY() <= blockpos.getY() + i && blockpos1.getY() >= blockpos.getY() - i && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(blockpos1) >= 0.15F)
{
double d3 = this.random.nextDouble();
double d4 = this.random.nextDouble();
if (block.getMaterial() == Material.lava)
{
this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
else if (block.getMaterial() != Material.air)
{
block.setBlockBoundsBasedOnState(world, blockpos2);
++j;
if (this.random.nextInt(j) == 0)
{
d0 = (double)blockpos2.getX() + d3;
d1 = (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
d2 = (double)blockpos2.getZ() + d4;
}
this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
if (j > 0 && this.random.nextInt(3) < this.rainSoundCounter++)
{
this.rainSoundCounter = 0;
if (d1 > (double)(blockpos.getY() + 1) && world.getPrecipitationHeight(blockpos).getY() > MathHelper.floor_float((float)blockpos.getY()))
{
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
}
else
{
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
}
}
}
}