本文整理匯總了Java中net.minecraft.init.Blocks.SNOW屬性的典型用法代碼示例。如果您正苦於以下問題:Java Blocks.SNOW屬性的具體用法?Java Blocks.SNOW怎麽用?Java Blocks.SNOW使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類net.minecraft.init.Blocks
的用法示例。
在下文中一共展示了Blocks.SNOW屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onUpdate
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected);
if (isSelected) {
double x = entityIn.posX;
double y = entityIn.posY;
double z = entityIn.posZ;
BlockPos pos = new BlockPos(x, --y, z);
if (entityIn instanceof EntityPlayer
&& !worldIn.isAirBlock(pos)
&& worldIn.getBlockState(pos).getBlock() != Blocks.BEDROCK
&& worldIn.getBlockState(pos).getBlock() != Blocks.SNOW
&& worldIn.getBlockState(pos).getBlock() != Blocks.LAVA
&& worldIn.getBlockState(pos).getBlock() != Blocks.WATER
&& worldIn.getBlockState(pos).isFullBlock()
&& worldIn.getBlockState(pos).isFullCube()) {
worldIn.setBlockState(pos, Blocks.SNOW.getDefaultState());
}
}
}
示例2: getGroundFromAbove
/**
* Gets the Y-value of the ground at a specifix x/y coordinate.
* @param world
* @param x
* @param z
* @return
*/
public static int getGroundFromAbove(World world, int x, int z)
{
int y = 255;
boolean foundGround = false;
while(!foundGround && y-- >= 63)
{
Block blockAt = world.getBlockState(new BlockPos(x,y,z)).getBlock();
foundGround = blockAt == Blocks.DIRT || blockAt == Blocks.GRASS || blockAt == Blocks.SAND || blockAt == Blocks.SNOW || blockAt == Blocks.SNOW_LAYER || blockAt == Blocks.GLASS;
}
return y;
}
示例3: safeImpact
@Override
public void safeImpact(BlockPos pos, @Nullable EnumFacing side, World world, int amplifier) {
int box = 1 + (int) ((float) amplifier / 2F);
BlockPos posI = pos.add(box, box, box);
BlockPos posF = pos.add(-box, -box, -box);
Iterable<BlockPos> spots = BlockPos.getAllInBox(posI, posF);
for (BlockPos spot : spots) {
IBlockState state = world.getBlockState(spot);
boolean place = amplifier > 2 || world.rand.nextBoolean();
if (place && state.getBlock() == Blocks.WATER && world.isAirBlock(spot.up())) {
world.setBlockState(spot, Blocks.ICE.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.ICE) {
world.setBlockState(spot, Blocks.PACKED_ICE.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.SNOW_LAYER) {
world.setBlockState(spot, Blocks.SNOW.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.SNOW) {
world.setBlockState(spot, Blocks.PACKED_ICE.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.FROSTED_ICE) {
world.setBlockState(spot, Blocks.ICE.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.LAVA) {
world.setBlockState(spot, Blocks.OBSIDIAN.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.FLOWING_LAVA) {
world.setBlockState(spot, Blocks.OBSIDIAN.getDefaultState(), 3);
} else if (state.getBlock() == Blocks.FLOWING_WATER) {
world.setBlockState(spot, Blocks.ICE.getDefaultState(), 3);
}
}
}
示例4: getGroundFromAbove
private int getGroundFromAbove(World world, int x, int z)
{
int y = 255;
boolean foundGround = false;
while(!foundGround && y-- >= 63)
{
Block blockAt = world.getBlockState(new BlockPos(x,y,z)).getBlock();
foundGround = blockAt == Blocks.DIRT || blockAt == Blocks.GRASS || blockAt == Blocks.SAND || blockAt == Blocks.SNOW || blockAt == Blocks.SNOW_LAYER || blockAt == Blocks.STONE;
}
return y;
}
示例5: getFaceQuadsMycelium
private static List getFaceQuadsMycelium(IBlockAccess p_getFaceQuadsMycelium_0_, IBlockState p_getFaceQuadsMycelium_1_, BlockPos p_getFaceQuadsMycelium_2_, EnumFacing p_getFaceQuadsMycelium_3_, List p_getFaceQuadsMycelium_4_)
{
Block block = p_getFaceQuadsMycelium_0_.getBlockState(p_getFaceQuadsMycelium_2_.up()).getBlock();
boolean flag = block == Blocks.SNOW || block == Blocks.SNOW_LAYER;
if (Config.isBetterGrassFancy())
{
if (flag)
{
if (betterMyceliumSnow && getBlockAt(p_getFaceQuadsMycelium_2_, p_getFaceQuadsMycelium_3_, p_getFaceQuadsMycelium_0_) == Blocks.SNOW_LAYER)
{
return modelCubeSnow.getQuads(p_getFaceQuadsMycelium_1_, p_getFaceQuadsMycelium_3_, 0L);
}
}
else if (betterMycelium && getBlockAt(p_getFaceQuadsMycelium_2_.down(), p_getFaceQuadsMycelium_3_, p_getFaceQuadsMycelium_0_) == Blocks.MYCELIUM)
{
return modelCubeMycelium.getQuads(p_getFaceQuadsMycelium_1_, p_getFaceQuadsMycelium_3_, 0L);
}
}
else if (flag)
{
if (betterMyceliumSnow)
{
return modelCubeSnow.getQuads(p_getFaceQuadsMycelium_1_, p_getFaceQuadsMycelium_3_, 0L);
}
}
else if (betterMycelium)
{
return modelCubeMycelium.getQuads(p_getFaceQuadsMycelium_1_, p_getFaceQuadsMycelium_3_, 0L);
}
return p_getFaceQuadsMycelium_4_;
}
示例6: getFaceQuadsGrass
private static List getFaceQuadsGrass(IBlockAccess p_getFaceQuadsGrass_0_, IBlockState p_getFaceQuadsGrass_1_, BlockPos p_getFaceQuadsGrass_2_, EnumFacing p_getFaceQuadsGrass_3_, List p_getFaceQuadsGrass_4_)
{
Block block = p_getFaceQuadsGrass_0_.getBlockState(p_getFaceQuadsGrass_2_.up()).getBlock();
boolean flag = block == Blocks.SNOW || block == Blocks.SNOW_LAYER;
if (Config.isBetterGrassFancy())
{
if (flag)
{
if (betterGrassSnow && getBlockAt(p_getFaceQuadsGrass_2_, p_getFaceQuadsGrass_3_, p_getFaceQuadsGrass_0_) == Blocks.SNOW_LAYER)
{
return modelCubeSnow.getQuads(p_getFaceQuadsGrass_1_, p_getFaceQuadsGrass_3_, 0L);
}
}
else if (betterGrass && getBlockAt(p_getFaceQuadsGrass_2_.down(), p_getFaceQuadsGrass_3_, p_getFaceQuadsGrass_0_) == Blocks.GRASS)
{
return modelCubeGrass.getQuads(p_getFaceQuadsGrass_1_, p_getFaceQuadsGrass_3_, 0L);
}
}
else if (flag)
{
if (betterGrassSnow)
{
return modelCubeSnow.getQuads(p_getFaceQuadsGrass_1_, p_getFaceQuadsGrass_3_, 0L);
}
}
else if (betterGrass)
{
return modelCubeGrass.getQuads(p_getFaceQuadsGrass_1_, p_getFaceQuadsGrass_3_, 0L);
}
return p_getFaceQuadsGrass_4_;
}
示例7: getTransitionedFlowingBlock
@Override
protected Block getTransitionedFlowingBlock() {
return Blocks.SNOW;
}
示例8: canHarvestBlock
@Override
public boolean canHarvestBlock(IBlockState blockIn) {
Block block = blockIn.getBlock();
return block == Blocks.SNOW_LAYER ? true : block == Blocks.SNOW;
}
示例9: generate
public boolean generate(World worldIn, Random rand, BlockPos position)
{
while (worldIn.isAirBlock(position) && position.getY() > 2)
{
position = position.down();
}
if (worldIn.getBlockState(position).getBlock() != Blocks.SNOW)
{
return false;
}
else
{
int i = rand.nextInt(this.basePathWidth - 2) + 2;
int j = 1;
for (int k = position.getX() - i; k <= position.getX() + i; ++k)
{
for (int l = position.getZ() - i; l <= position.getZ() + i; ++l)
{
int i1 = k - position.getX();
int j1 = l - position.getZ();
if (i1 * i1 + j1 * j1 <= i * i)
{
for (int k1 = position.getY() - 1; k1 <= position.getY() + 1; ++k1)
{
BlockPos blockpos = new BlockPos(k, k1, l);
Block block = worldIn.getBlockState(blockpos).getBlock();
if (block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE)
{
worldIn.setBlockState(blockpos, this.block.getDefaultState(), 2);
}
}
}
}
}
return true;
}
}
示例10: canHarvestBlock
/**
* Check whether this Item can harvest the given Block
*/
public boolean canHarvestBlock(IBlockState blockIn)
{
Block block = blockIn.getBlock();
return block == Blocks.SNOW_LAYER ? true : block == Blocks.SNOW;
}
示例11: getFaceQuadsDirt
private static List getFaceQuadsDirt(IBlockAccess p_getFaceQuadsDirt_0_, IBlockState p_getFaceQuadsDirt_1_, BlockPos p_getFaceQuadsDirt_2_, EnumFacing p_getFaceQuadsDirt_3_, List p_getFaceQuadsDirt_4_)
{
Block block = getBlockAt(p_getFaceQuadsDirt_2_, EnumFacing.UP, p_getFaceQuadsDirt_0_);
if (p_getFaceQuadsDirt_1_.getValue(BlockDirt.VARIANT) != BlockDirt.DirtType.PODZOL)
{
return block == Blocks.GRASS_PATH ? (betterGrassPath && getBlockAt(p_getFaceQuadsDirt_2_, p_getFaceQuadsDirt_3_, p_getFaceQuadsDirt_0_) == Blocks.GRASS_PATH ? modelCubeGrassPath.getQuads(p_getFaceQuadsDirt_1_, p_getFaceQuadsDirt_3_, 0L) : p_getFaceQuadsDirt_4_) : p_getFaceQuadsDirt_4_;
}
else
{
boolean flag = block == Blocks.SNOW || block == Blocks.SNOW_LAYER;
if (Config.isBetterGrassFancy())
{
if (flag)
{
if (betterPodzolSnow && getBlockAt(p_getFaceQuadsDirt_2_, p_getFaceQuadsDirt_3_, p_getFaceQuadsDirt_0_) == Blocks.SNOW_LAYER)
{
return modelCubeSnow.getQuads(p_getFaceQuadsDirt_1_, p_getFaceQuadsDirt_3_, 0L);
}
}
else if (betterPodzol)
{
BlockPos blockpos = p_getFaceQuadsDirt_2_.down().offset(p_getFaceQuadsDirt_3_);
IBlockState iblockstate = p_getFaceQuadsDirt_0_.getBlockState(blockpos);
if (iblockstate.getBlock() == Blocks.DIRT && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL)
{
return modelCubePodzol.getQuads(p_getFaceQuadsDirt_1_, p_getFaceQuadsDirt_3_, 0L);
}
}
}
else if (flag)
{
if (betterPodzolSnow)
{
return modelCubeSnow.getQuads(p_getFaceQuadsDirt_1_, p_getFaceQuadsDirt_3_, 0L);
}
}
else if (betterPodzol)
{
return modelCubePodzol.getQuads(p_getFaceQuadsDirt_1_, p_getFaceQuadsDirt_3_, 0L);
}
return p_getFaceQuadsDirt_4_;
}
}