本文整理汇总了Java中net.minecraft.block.BlockFlower类的典型用法代码示例。如果您正苦于以下问题:Java BlockFlower类的具体用法?Java BlockFlower怎么用?Java BlockFlower使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockFlower类属于net.minecraft.block包,在下文中一共展示了BlockFlower类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: flowerGenerator
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
private void flowerGenerator(BlockFlower flower, World worldIn, Random random, int chunkX, int chunkZ, float chancesToSpawn)
{
for(int i = 0; i < chancesToSpawn; i++)
if(random.nextFloat() < chancesToSpawn)
{
int x = chunkX * 16 + random.nextInt(16);
int z = chunkZ * 16 + random.nextInt(16);
BlockPos position = worldIn.getTopSolidOrLiquidBlock(new BlockPos(x, 0, z));
BlockPos blockpos = position.add(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), random.nextInt(8) - random.nextInt(8));
if (worldIn.isAirBlock(blockpos) && (worldIn.provider.isSurfaceWorld() || blockpos.getY() < 255) &&
flower.canBlockStay(worldIn, blockpos, flower.getDefaultState()))
{
worldIn.setBlockState(blockpos,flower.getDefaultState(), 2);
}
}
}
示例2: dropFewItems
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
/**
* Drop 0-2 items of this living's type
*/
protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)
{
int i = this.rand.nextInt(3);
for (int j = 0; j < i; ++j)
{
this.dropItemWithOffset(Item.getItemFromBlock(Blocks.red_flower), 1, (float)BlockFlower.EnumFlowerType.POPPY.getMeta());
}
int l = 3 + this.rand.nextInt(3);
for (int k = 0; k < l; ++k)
{
this.dropItem(Items.iron_ingot, 1);
}
}
示例3: func_150572_a
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public String func_150572_a(Random p_150572_1_, int p_150572_2_, int p_150572_3_, int p_150572_4_)
{
if (this.field_150632_aF == 1)
{
double var5 = MathHelper.clamp_double((1.0D + field_150606_ad.func_151601_a((double)p_150572_2_ / 48.0D, (double)p_150572_4_ / 48.0D)) / 2.0D, 0.0D, 0.9999D);
int var7 = (int)(var5 * (double)BlockFlower.field_149859_a.length);
if (var7 == 1)
{
var7 = 0;
}
return BlockFlower.field_149859_a[var7];
}
else
{
return super.func_150572_a(p_150572_1_, p_150572_2_, p_150572_3_, p_150572_4_);
}
}
示例4: func_150572_a
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public String func_150572_a(Random p_150572_1_, int p_150572_2_, int p_150572_3_, int p_150572_4_)
{
double var5 = field_150606_ad.func_151601_a((double)p_150572_2_ / 200.0D, (double)p_150572_4_ / 200.0D);
int var7;
if (var5 < -0.8D)
{
var7 = p_150572_1_.nextInt(4);
return BlockFlower.field_149859_a[4 + var7];
}
else if (p_150572_1_.nextInt(3) > 0)
{
var7 = p_150572_1_.nextInt(3);
return var7 == 0 ? BlockFlower.field_149859_a[0] : (var7 == 1 ? BlockFlower.field_149859_a[3] : BlockFlower.field_149859_a[8]);
}
else
{
return BlockFlower.field_149858_b[0];
}
}
示例5: func_149857_e
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public static BlockFlower func_149857_e(String name) {
String[] astring = field_149858_b;
int i = astring.length;
int j;
String s1;
for (j = 0; j < i; ++j) {
s1 = astring[j];
if (s1.equals(name)) {
return (BlockFlower) BPBlocks.indigo_flower;
}
}
return null;
}
示例6: func_150572_a
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public String func_150572_a(Random p_150572_1_, int p_150572_2_, int p_150572_3_, int p_150572_4_)
{
double d0 = plantNoise.func_151601_a((double)p_150572_2_ / 200.0D, (double)p_150572_4_ / 200.0D);
int l;
if (d0 < -0.8D)
{
l = p_150572_1_.nextInt(4);
return BlockFlower.field_149859_a[4 + l];
}
else if (p_150572_1_.nextInt(3) > 0)
{
l = p_150572_1_.nextInt(3);
return l == 0 ? BlockFlower.field_149859_a[0] : (l == 1 ? BlockFlower.field_149859_a[3] : BlockFlower.field_149859_a[8]);
}
else
{
return BlockFlower.field_149858_b[0];
}
}
示例7: func_150572_a
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public String func_150572_a(Random p_150572_1_, int p_150572_2_, int p_150572_3_, int p_150572_4_)
{
if (this.field_150632_aF == 1)
{
double d0 = MathHelper.clamp_double((1.0D + plantNoise.func_151601_a((double)p_150572_2_ / 48.0D, (double)p_150572_4_ / 48.0D)) / 2.0D, 0.0D, 0.9999D);
int l = (int)(d0 * (double)BlockFlower.field_149859_a.length);
if (l == 1)
{
l = 0;
}
return BlockFlower.field_149859_a[l];
}
else
{
return super.func_150572_a(p_150572_1_, p_150572_2_, p_150572_3_, p_150572_4_);
}
}
示例8: onBlockDestroyed
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
@Override
public boolean onBlockDestroyed(ItemStack itemstack, World world, IBlockState state, BlockPos pos, EntityLivingBase entityLiving)
{
boolean done = false;
int size = 2;
for(int newX = -size; newX <= size; newX++)
{
for(int newZ = -size; newZ <= size; newZ++)
{
BlockPos pos2 = pos.add(newX, 0, newZ);
IBlockState sta = world.getBlockState(pos2);
Block block = sta.getBlock();
if((block instanceof BlockBush) || (block instanceof BlockFlower) || (block instanceof BlockDoublePlant))
{
block.dropBlockAsItem(world, pos2, sta, 0);
world.setBlockToAir(pos2);
itemstack.damageItem(1, entityLiving);
done = true;
}
}
}
return done;
}
示例9: canSustainPlant
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
@Override
public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
{
final int metadata = world.getBlockMetadata(x, y, z);
if (metadata < 5 && metadata > 13)
{
return false;
}
plant.getPlantID(world, x, y + 1, z);
if (plant instanceof BlockFlower)
{
return true;
}
return false;
}
示例10: pickRandomFlower
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
{
if (this.field_150632_aF == 1)
{
double d0 = MathHelper.clamp_double((1.0D + GRASS_COLOR_NOISE.func_151601_a((double)pos.getX() / 48.0D, (double)pos.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
BlockFlower.EnumFlowerType blockflower$enumflowertype = BlockFlower.EnumFlowerType.values()[(int)(d0 * (double)BlockFlower.EnumFlowerType.values().length)];
return blockflower$enumflowertype == BlockFlower.EnumFlowerType.BLUE_ORCHID ? BlockFlower.EnumFlowerType.POPPY : blockflower$enumflowertype;
}
else
{
return super.pickRandomFlower(rand, pos);
}
}
示例11: pickRandomFlower
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
{
double d0 = GRASS_COLOR_NOISE.func_151601_a((double)pos.getX() / 200.0D, (double)pos.getZ() / 200.0D);
if (d0 < -0.8D)
{
int j = rand.nextInt(4);
switch (j)
{
case 0:
return BlockFlower.EnumFlowerType.ORANGE_TULIP;
case 1:
return BlockFlower.EnumFlowerType.RED_TULIP;
case 2:
return BlockFlower.EnumFlowerType.PINK_TULIP;
case 3:
default:
return BlockFlower.EnumFlowerType.WHITE_TULIP;
}
}
else if (rand.nextInt(3) > 0)
{
int i = rand.nextInt(3);
return i == 0 ? BlockFlower.EnumFlowerType.POPPY : (i == 1 ? BlockFlower.EnumFlowerType.HOUSTONIA : BlockFlower.EnumFlowerType.OXEYE_DAISY);
}
else
{
return BlockFlower.EnumFlowerType.DANDELION;
}
}
示例12: pickRandomFlower
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
{
double d0 = GRASS_COLOR_NOISE.getValue((double)pos.getX() / 200.0D, (double)pos.getZ() / 200.0D);
if (d0 < -0.8D)
{
int j = rand.nextInt(4);
switch (j)
{
case 0:
return BlockFlower.EnumFlowerType.ORANGE_TULIP;
case 1:
return BlockFlower.EnumFlowerType.RED_TULIP;
case 2:
return BlockFlower.EnumFlowerType.PINK_TULIP;
case 3:
default:
return BlockFlower.EnumFlowerType.WHITE_TULIP;
}
}
else if (rand.nextInt(3) > 0)
{
int i = rand.nextInt(3);
return i == 0 ? BlockFlower.EnumFlowerType.POPPY : (i == 1 ? BlockFlower.EnumFlowerType.HOUSTONIA : BlockFlower.EnumFlowerType.OXEYE_DAISY);
}
else
{
return BlockFlower.EnumFlowerType.DANDELION;
}
}
示例13: pickRandomFlower
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
{
if (this.type == BiomeForest.Type.FLOWER)
{
double d0 = MathHelper.clamp((1.0D + GRASS_COLOR_NOISE.getValue((double)pos.getX() / 48.0D, (double)pos.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D);
BlockFlower.EnumFlowerType blockflower$enumflowertype = BlockFlower.EnumFlowerType.values()[(int)(d0 * (double)BlockFlower.EnumFlowerType.values().length)];
return blockflower$enumflowertype == BlockFlower.EnumFlowerType.BLUE_ORCHID ? BlockFlower.EnumFlowerType.POPPY : blockflower$enumflowertype;
}
else
{
return super.pickRandomFlower(rand, pos);
}
}
示例14: getBoundingBox
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public AxisAlignedBB getBoundingBox(IBlockAccess blockAccess, BlockPos pos)
{
Block.EnumOffsetType block$enumoffsettype = this.block.getOffsetType();
if (block$enumoffsettype != Block.EnumOffsetType.NONE && !(this.block instanceof BlockFlower))
{
AxisAlignedBB axisalignedbb = this.block.getBoundingBox(this, blockAccess, pos);
axisalignedbb = BlockModelUtils.getOffsetBoundingBox(axisalignedbb, block$enumoffsettype, pos);
return axisalignedbb;
}
else
{
return this.block.getBoundingBox(this, blockAccess, pos);
}
}
示例15: pickRandomFlower
import net.minecraft.block.BlockFlower; //导入依赖的package包/类
public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos)
{
double d0 = GRASS_COLOR_NOISE.getValue((double)pos.getX() / 200.0D, (double)pos.getZ() / 200.0D);
if (d0 < -0.8D)
{
int j = rand.nextInt(4);
switch (j)
{
case 0:
return BlockFlower.EnumFlowerType.ORANGE_TULIP;
case 1:
return BlockFlower.EnumFlowerType.RED_TULIP;
case 2:
return BlockFlower.EnumFlowerType.PINK_TULIP;
case 3:
default:
return BlockFlower.EnumFlowerType.WHITE_TULIP;
}
}
else if (rand.nextInt(3) > 0)
{
int i = rand.nextInt(3);
return i == 0 ? BlockFlower.EnumFlowerType.POPPY : (i == 1 ? BlockFlower.EnumFlowerType.HOUSTONIA : BlockFlower.EnumFlowerType.OXEYE_DAISY);
}
else
{
return BlockFlower.EnumFlowerType.DANDELION;
}
}