当前位置: 首页>>代码示例>>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;未经允许,请勿转载。