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


Java Blocks.SNOW_LAYER屬性代碼示例

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


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

示例1: canPlaceBlockOnSide

@SideOnly(Side.CLIENT)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack)
{
    Block block = worldIn.getBlockState(pos).getBlock();

    if (block == Blocks.SNOW_LAYER && block.isReplaceable(worldIn, pos))
    {
        side = EnumFacing.UP;
    }
    else if (!block.isReplaceable(worldIn, pos))
    {
        pos = pos.offset(side);
    }

    return worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:16,代碼來源:ItemBlock.java

示例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;
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:19,代碼來源:LSCWorldGenerator.java

示例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);
		}
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:30,代碼來源:FrostbiteBrew.java

示例4: getChestCoords

private BlockPos getChestCoords(World world, BlockPos pos, EnumFacing facing)
{
    IBlockState iblockstate = world.getBlockState(pos);
    Block block = iblockstate.getBlock();

    if (block != Blocks.SNOW_LAYER || iblockstate.getValue(BlockSnow.LAYERS) >= 1)
    {
        if (!block.isReplaceable(world, pos))
        {
            pos = pos.offset(facing);
        }
    }

    return pos;
}
 
開發者ID:cubex2,項目名稱:chesttransporter,代碼行數:15,代碼來源:ItemChestTransporter.java

示例5: getSnowTopPosition

private static BlockPos getSnowTopPosition(WorldServer world, BlockPos pos) {
	pos = world.getPrecipitationHeight(pos);
  		
  		// Precipitation height ignores snow blocks, need to loop to the top of the stack
  		while (world.getBlockState(pos.up()).getBlock() == Blocks.SNOW_LAYER) {
  			pos = pos.up();
  		}
  		
  		return pos;
}
 
開發者ID:cam72cam,項目名稱:WinterWonderLand,代碼行數:10,代碼來源:WinterWonderLand.java

示例6: snowHeightAt

private static int snowHeightAt(WorldServer world, BlockPos pos) {
IBlockState currentBlock = world.getBlockState(pos);
if (currentBlock.getBlock() == Blocks.SNOW_LAYER) {
	return snowHeightAt(world, pos.down()) + currentBlock.getValue(BlockSnow.LAYERS);
}
if (currentBlock.getBlock() == Blocks.AIR && world.getBlockState(pos.down()).getBlock() != Blocks.AIR) {
	return snowHeightAt(world, pos.down());
}
return 0;
 	}
 
開發者ID:cam72cam,項目名稱:WinterWonderLand,代碼行數:10,代碼來源:WinterWonderLand.java

示例7: 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;
}
 
開發者ID:OCDiary,項目名稱:TheOink,代碼行數:12,代碼來源:OinkWorldGenerator.java

示例8: playStepSound

protected void playStepSound(BlockPos pos, Block blockIn)
{
    SoundType soundtype = blockIn.getSoundType();

    if (this.world.getBlockState(pos.up()).getBlock() == Blocks.SNOW_LAYER)
    {
        soundtype = Blocks.SNOW_LAYER.getSoundType();
        this.playSound(soundtype.getStepSound(), soundtype.getVolume() * 0.15F, soundtype.getPitch());
    }
    else if (!blockIn.getDefaultState().getMaterial().isLiquid())
    {
        this.playSound(soundtype.getStepSound(), soundtype.getVolume() * 0.15F, soundtype.getPitch());
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:14,代碼來源:Entity.java

示例9: playStepSound

protected void playStepSound(BlockPos pos, Block blockIn)
{
    if (!blockIn.getDefaultState().getMaterial().isLiquid())
    {
        SoundType soundtype = blockIn.getSoundType();

        if (this.world.getBlockState(pos.up()).getBlock() == Blocks.SNOW_LAYER)
        {
            soundtype = Blocks.SNOW_LAYER.getSoundType();
        }

        if (this.isBeingRidden() && this.field_190688_bE)
        {
            ++this.gallopTime;

            if (this.gallopTime > 5 && this.gallopTime % 3 == 0)
            {
                this.func_190680_a(soundtype);
            }
            else if (this.gallopTime <= 5)
            {
                this.playSound(SoundEvents.ENTITY_HORSE_STEP_WOOD, soundtype.getVolume() * 0.15F, soundtype.getPitch());
            }
        }
        else if (soundtype == SoundType.WOOD)
        {
            this.playSound(SoundEvents.ENTITY_HORSE_STEP_WOOD, soundtype.getVolume() * 0.15F, soundtype.getPitch());
        }
        else
        {
            this.playSound(SoundEvents.ENTITY_HORSE_STEP, soundtype.getVolume() * 0.15F, soundtype.getPitch());
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:34,代碼來源:AbstractHorse.java

示例10: canPlaceBlockOnSide

public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack)
{
    Block block = worldIn.getBlockState(pos).getBlock();

    if (block == Blocks.SNOW_LAYER)
    {
        side = EnumFacing.UP;
    }
    else if (!block.isReplaceable(worldIn, pos))
    {
        pos = pos.offset(side);
    }

    return worldIn.func_190527_a(this.block, pos, false, side, (Entity)null);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:15,代碼來源:ItemBlock.java

示例11: onItemUse

@Nonnull
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Block block = iblockstate.getBlock();
    Block cake = Block.REGISTRY.getObject(new ResourceLocation(FoodCraftReloaded.MODID, NameBuilder.buildRegistryName(fruitType.toString(), "cake")));

    if (block == Blocks.SNOW_LAYER && iblockstate.getValue(BlockSnow.LAYERS) < 1)
        facing = EnumFacing.UP;
    else if (!block.isReplaceable(worldIn, pos))
        pos = pos.offset(facing);

    ItemStack itemstack = player.getHeldItem(hand);

    if (!itemstack.isEmpty() && player.canPlayerEdit(pos, facing, itemstack) && worldIn.mayPlace(cake, pos, false, facing, null)) {
        IBlockState blockState = cake.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, 0, player, hand);

        if (!worldIn.setBlockState(pos, blockState, 11))
            return EnumActionResult.FAIL;
        else {
            blockState = worldIn.getBlockState(pos);

            if (blockState.getBlock() == cake) {
                ItemBlock.setTileEntityNBT(worldIn, player, pos, itemstack);
                blockState.getBlock().onBlockPlacedBy(worldIn, pos, blockState, player, itemstack);
            }

            SoundType soundtype = blockState.getBlock().getSoundType(blockState, worldIn, pos, player);
            worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
            itemstack.shrink(1);
            return EnumActionResult.SUCCESS;
        }
    }
    else
        return EnumActionResult.FAIL;
}
 
開發者ID:LasmGratel,項目名稱:FoodCraft-Reloaded,代碼行數:35,代碼來源:ItemFruitCake.java

示例12: isNeighbourOverlay

private static boolean isNeighbourOverlay(ConnectedProperties p_isNeighbourOverlay_0_, IBlockAccess p_isNeighbourOverlay_1_, IBlockState p_isNeighbourOverlay_2_, BlockPos p_isNeighbourOverlay_3_, int p_isNeighbourOverlay_4_, TextureAtlasSprite p_isNeighbourOverlay_5_, int p_isNeighbourOverlay_6_)
{
    IBlockState iblockstate = p_isNeighbourOverlay_1_.getBlockState(p_isNeighbourOverlay_3_);

    if (!isFullCubeModel(iblockstate))
    {
        return false;
    }
    else
    {
        if (p_isNeighbourOverlay_0_.connectBlocks != null)
        {
            BlockStateBase blockstatebase = (BlockStateBase)iblockstate;

            if (!Matches.block(blockstatebase.getBlockId(), blockstatebase.getMetadata(), p_isNeighbourOverlay_0_.connectBlocks))
            {
                return false;
            }
        }

        if (p_isNeighbourOverlay_0_.connectTileIcons != null)
        {
            TextureAtlasSprite textureatlassprite = getNeighbourIcon(p_isNeighbourOverlay_1_, p_isNeighbourOverlay_2_, p_isNeighbourOverlay_3_, iblockstate, p_isNeighbourOverlay_4_);

            if (!Config.isSameOne(textureatlassprite, p_isNeighbourOverlay_0_.connectTileIcons))
            {
                return false;
            }
        }

        IBlockState iblockstate1 = p_isNeighbourOverlay_1_.getBlockState(p_isNeighbourOverlay_3_.offset(getFacing(p_isNeighbourOverlay_4_)));
        return iblockstate1.isOpaqueCube() ? false : (p_isNeighbourOverlay_4_ == 1 && iblockstate1.getBlock() == Blocks.SNOW_LAYER ? false : !isNeighbour(p_isNeighbourOverlay_0_, p_isNeighbourOverlay_1_, p_isNeighbourOverlay_2_, p_isNeighbourOverlay_3_, iblockstate, p_isNeighbourOverlay_4_, p_isNeighbourOverlay_5_, p_isNeighbourOverlay_6_));
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:34,代碼來源:ConnectedTextures.java

示例13: isNeighbourMatching

private static boolean isNeighbourMatching(ConnectedProperties p_isNeighbourMatching_0_, IBlockAccess p_isNeighbourMatching_1_, IBlockState p_isNeighbourMatching_2_, BlockPos p_isNeighbourMatching_3_, int p_isNeighbourMatching_4_, TextureAtlasSprite p_isNeighbourMatching_5_, int p_isNeighbourMatching_6_)
{
    IBlockState iblockstate = p_isNeighbourMatching_1_.getBlockState(p_isNeighbourMatching_3_);

    if (iblockstate == AIR_DEFAULT_STATE)
    {
        return false;
    }
    else
    {
        if (p_isNeighbourMatching_0_.matchBlocks != null && iblockstate instanceof BlockStateBase)
        {
            BlockStateBase blockstatebase = (BlockStateBase)iblockstate;

            if (!p_isNeighbourMatching_0_.matchesBlock(blockstatebase.getBlockId(), blockstatebase.getMetadata()))
            {
                return false;
            }
        }

        if (p_isNeighbourMatching_0_.matchTileIcons != null)
        {
            TextureAtlasSprite textureatlassprite = getNeighbourIcon(p_isNeighbourMatching_1_, p_isNeighbourMatching_2_, p_isNeighbourMatching_3_, iblockstate, p_isNeighbourMatching_4_);

            if (textureatlassprite != p_isNeighbourMatching_5_)
            {
                return false;
            }
        }

        IBlockState iblockstate1 = p_isNeighbourMatching_1_.getBlockState(p_isNeighbourMatching_3_.offset(getFacing(p_isNeighbourMatching_4_)));
        return iblockstate1.isOpaqueCube() ? false : p_isNeighbourMatching_4_ != 1 || iblockstate1.getBlock() != Blocks.SNOW_LAYER;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:34,代碼來源:ConnectedTextures.java

示例14: canHarvestBlock

@Override
public boolean canHarvestBlock(IBlockState blockIn) {
	Block block = blockIn.getBlock();
	return block == Blocks.SNOW_LAYER ? true : block == Blocks.SNOW;
}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:5,代碼來源:ItemATShovel.java

示例15: canReplaceBlock

protected boolean canReplaceBlock(IBlockState p_175793_1_, IBlockState p_175793_2_)
{
    return p_175793_1_.getBlock() == Blocks.STONE ? true : (p_175793_1_.getBlock() == Blocks.DIRT ? true : (p_175793_1_.getBlock() == Blocks.GRASS ? true : (p_175793_1_.getBlock() == Blocks.HARDENED_CLAY ? true : (p_175793_1_.getBlock() == Blocks.STAINED_HARDENED_CLAY ? true : (p_175793_1_.getBlock() == Blocks.SANDSTONE ? true : (p_175793_1_.getBlock() == Blocks.RED_SANDSTONE ? true : (p_175793_1_.getBlock() == Blocks.MYCELIUM ? true : (p_175793_1_.getBlock() == Blocks.SNOW_LAYER ? true : (p_175793_1_.getBlock() == Blocks.SAND || p_175793_1_.getBlock() == Blocks.GRAVEL) && p_175793_2_.getMaterial() != Material.WATER))))))));
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:4,代碼來源:MapGenCaves.java


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