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


Java World.isSideSolid方法代碼示例

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


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

示例1: neighborChanged

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
	if(worldIn.isBlockPowered(pos) && worldIn.getBlockState(pos.offset(state.getValue(FACING))).getBlock().canPlaceBlockAt(worldIn, pos.offset(state.getValue(FACING)))
			&& !(worldIn.getBlockState(pos.offset(state.getValue(FACING))).getBlock() instanceof BloodBlock)
			&& !blocksOnMap.containsKey(pos) && worldIn.isSideSolid(pos.offset(state.getValue(FACING)).down(), EnumFacing.UP)
			&& worldIn.getBlockState(pos.up()).getBlock() instanceof BloodVessel 
			&& ((TileEntityBloodVessel)worldIn.getTileEntity(pos.up())).canRemove(1))
	{
		blocksOnMap.put(pos, true);
		((TileEntityBloodVessel)worldIn.getTileEntity(pos.up())).change(-1);
		HarshenNetwork.sendToAll(new MessagePacketTileEntityBloodPlacerUpdated(pos.up(), ((TileEntityBloodVessel)worldIn.getTileEntity(pos.up())).getPossibleRemove()));
		worldIn.setBlockState(pos.offset(state.getValue(FACING)), HarshenBlocks.BLOOD_BLOCK.getDefaultState(), 3);
	}
	else if(!worldIn.isBlockPowered(pos) && blocksOnMap.containsKey(pos))
		blocksOnMap.remove(pos);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:17,代碼來源:BloodPlacer.java

示例2: onItemUse

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
    ItemStack is = player.getHeldItem(hand);
    if(is.getItemDamage() == 0)
    {
        if(side == EnumFacing.UP)
        {
            if(world.isSideSolid(pos, side, false))
            {
                is.shrink(1);
                if(!world.isRemote)
                {
                    world.spawnEntity(new EntityTorchFirework(world, pos.getX(), pos.getY(), pos.getZ(), player.capabilities.isCreativeMode && player.isSneaking()));
                }
                return EnumActionResult.SUCCESS;
            }
        }
    }
    return EnumActionResult.PASS;
}
 
開發者ID:iChun,項目名稱:Torched,代碼行數:22,代碼來源:ItemTorchFirework.java

示例3: onBlockPlaced

import net.minecraft.world.World; //導入方法依賴的package包/類
/**
 * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
 * IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
    if (this.canPlaceAt(worldIn, pos, facing))
    {
        return this.getDefaultState().withProperty(FACING, facing);
    }
    else
    {
        for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
        {
            if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true))
            {
                return this.getDefaultState().withProperty(FACING, enumfacing);
            }
        }

        return this.getDefaultState();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:24,代碼來源:BlockTorch.java

示例4: generate

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public boolean generate(World worldIn, Random rand, BlockPos position)
{
	for (int i = 0; i < 16; ++i)
	{
		BlockPos offset = position.add(rand.nextInt(6) - rand.nextInt(6), 6, rand.nextInt(6) - rand.nextInt(6));
		while (!worldIn.isSideSolid(offset.down(), EnumFacing.UP, false) && offset.getY() > 0)
		{
			offset = offset.down();
		}
		
		if (worldIn.isAirBlock(offset) && !worldIn.getBlockState(offset.down()).getBlock().isAssociatedBlock(Blocks.SAND))
		{
			EnumRockClass erc = GenerationHelper.getStoneTypeAt(worldIn, offset);
			worldIn.setBlockState(offset, ExPBlocks.pebble.getDefaultState().withProperty(ExPBlockProperties.ROCK_CLASS, erc), 2);
		}
	}
	
	return true;
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:21,代碼來源:PebbleGenerator.java

示例5: generate

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public boolean generate(World worldIn, Random rand, BlockPos position)
{
	for (int i = 0; i < 4; ++i)
	{
		BlockPos offset = position.add(rand.nextInt(8) - rand.nextInt(8), 4, rand.nextInt(8) - rand.nextInt(8));
		while (!worldIn.isSideSolid(offset.down(), EnumFacing.UP, false) && offset.getY() > 0)
		{
			offset = offset.down();
		}
		
		if (worldIn.isAirBlock(offset) && !worldIn.getBlockState(offset.down()).getBlock().isAssociatedBlock(Blocks.SAND))
		{
			EnumRockClass erc = GenerationHelper.getStoneTypeAt(worldIn, offset);
			worldIn.setBlockState(offset, ExPBlocks.boulder.getDefaultState().withProperty(ExPBlockProperties.ROCK_CLASS, erc), 2);
		}
	}
	
	return true;
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:21,代碼來源:BoulderGenerator.java

示例6: newPart

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public TMultiPart newPart(ItemStack item, EntityPlayer player, World world, BlockPos pos, int side, Vector3 vhit) {
    BlockPos onPos = pos.offset(EnumFacing.VALUES[side ^ 1]);
    if (!world.isSideSolid(onPos, EnumFacing.VALUES[side]))
        return null;

    WirelessPart part = getPart(item.getItemDamage());
    part.setupPlacement(player, side);
    return part;
}
 
開發者ID:TheCBProject,項目名稱:WirelessRedstone,代碼行數:11,代碼來源:ItemWirelessPart.java

示例7: canPlaceAt

import net.minecraft.world.World; //導入方法依賴的package包/類
private boolean canPlaceAt (World world, BlockPos pos, EnumFacing facing) {
    BlockPos blockPos = pos.offset(facing.getOpposite());
    if (facing.getAxis().isHorizontal())
        return world.isSideSolid(blockPos, facing, true);
    if (facing == EnumFacing.UP)
        return canPlaceOn(world, blockPos);
    if (facing == EnumFacing.DOWN)
        return true;

    return false;
}
 
開發者ID:jaquadro,項目名稱:GardenStuff,代碼行數:12,代碼來源:BlockCandelabra.java

示例8: onNeighborChangeInternal

import net.minecraft.world.World; //導入方法依賴的package包/類
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state)
{
    if (!this.checkForDrop(worldIn, pos, state))
    {
        return true;
    }
    else
    {
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        EnumFacing.Axis enumfacing$axis = enumfacing.getAxis();
        EnumFacing enumfacing1 = enumfacing.getOpposite();
        boolean flag = false;

        if (enumfacing$axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing, true))
        {
            flag = true;
        }
        else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1)))
        {
            flag = true;
        }

        if (flag)
        {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
            return true;
        }
        else
        {
            return false;
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:35,代碼來源:BlockTorch.java

示例9: onItemUse

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	if (facing == EnumFacing.DOWN) {
		return EnumActionResult.FAIL;
	}
	else {
		if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos)) {
			facing = EnumFacing.UP;
			pos = pos.down();
		}
		IBlockState iblockstate = worldIn.getBlockState(pos);
		Block block = iblockstate.getBlock();
		boolean flag = block.isReplaceable(worldIn, pos);
		if (!flag) {
			if (!worldIn.getBlockState(pos).getMaterial().isSolid() && !worldIn.isSideSolid(pos, facing, true)) {
				return EnumActionResult.FAIL;
			}

			pos = pos.offset(facing);
		}
		ItemStack stack = player.getHeldItem(hand);
		if (player.canPlayerEdit(pos, facing, stack) && Blocks.SKULL.canPlaceBlockAt(worldIn, pos)) {
			if (worldIn.isRemote || skullBlock == null) {
				return EnumActionResult.SUCCESS;
			}
			else {
				worldIn.setBlockState(pos, skullBlock.getDefaultState().withProperty(BlockSkull.FACING, facing), 11);
				int i = 0;

				if (facing == EnumFacing.UP) {
					i = MathUtils.floor(player.rotationYaw * 16.0F / 360.0F + 0.5D) & 15;
				}
				TileEntity tileentity = worldIn.getTileEntity(pos);
				if (tileentity instanceof TileBlockSkull) {
					TileBlockSkull tileentityskull = (TileBlockSkull) tileentity;
					tileentityskull.setSkullRotation(i);
				}
				stack.shrink(1);
				return EnumActionResult.SUCCESS;
			}
		}
		else {
			return EnumActionResult.FAIL;
		}
	}
}
 
開發者ID:p455w0rd,項目名稱:EndermanEvolution,代碼行數:47,代碼來源:ItemSkullBase.java

示例10: canPlaceBlockAt

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public boolean canPlaceBlockAt(World world, BlockPos pos)
{
    return world.getBlockState(pos).getBlock().isReplaceable(world, pos) &&
        world.isSideSolid(pos.offset(EnumFacing.DOWN), EnumFacing.UP);
}
 
開發者ID:einsteinsci,項目名稱:BetterBeginningsReborn,代碼行數:7,代碼來源:BlockCampfire.java

示例11: canAttach

import net.minecraft.world.World; //導入方法依賴的package包/類
private boolean canAttach(World world, BlockPos pos, EnumFacing side)
{
    return world.isSideSolid(pos, side);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:5,代碼來源:BlockLever.java

示例12: canPlaceAt

import net.minecraft.world.World; //導入方法依賴的package包/類
private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing)
{
    BlockPos blockpos = pos.offset(facing.getOpposite());
    boolean flag = facing.getAxis().isHorizontal();
    return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:7,代碼來源:BlockTorch.java


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