本文整理了Java中net.minecraft.block.Block.canPlaceBlockOnSide()
方法的一些代码示例,展示了Block.canPlaceBlockOnSide()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.canPlaceBlockOnSide()
方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:canPlaceBlockOnSide
暂无
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
protected boolean canPlant(@Nonnull IFarmer farm, @Nonnull World world, @Nonnull BlockPos bc) {
return getPlantedBlock().canPlaceBlockOnSide(world, bc, EnumFacing.DOWN);
}
代码示例来源:origin: vadis365/TheErebus
@Override
public boolean generate(World world, Random rand, BlockPos pos) {
for (; pos.getY() < maxVineHeight + rand.nextInt(variation) - rand.nextInt(variation); pos = pos.up()) {
if (world.isBlockLoaded(pos) && world.isAirBlock(pos))
for (EnumFacing facing : EnumFacing.Plane.HORIZONTAL.facings())
if (world.isBlockLoaded(pos.offset(facing))) {
if (Blocks.VINE.canPlaceBlockOnSide(world, pos, facing)) {
IBlockState state = Blocks.VINE.getDefaultState()
.withProperty(BlockVine.NORTH, Boolean.valueOf(facing == EnumFacing.SOUTH))
.withProperty(BlockVine.EAST, Boolean.valueOf(facing == EnumFacing.WEST))
.withProperty(BlockVine.SOUTH, Boolean.valueOf(facing == EnumFacing.NORTH))
.withProperty(BlockVine.WEST, Boolean.valueOf(facing == EnumFacing.EAST));
world.setBlockState(pos, state, 2);
break;
}
} else
pos = pos.add(rand.nextInt(4) - rand.nextInt(4), 0, rand.nextInt(4) - rand.nextInt(4));
}
return true;
}
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
public IWrappedBlock registerStackWrapper(Item item, Predicate<ItemStack> predicate, Block block) {
IMultipart part = getPart(block);
Preconditions.checkState(part != null, "Attempted to wrap the placement of a block that's not registered as a multipart!");
WrappedBlock wrappedBlock = new WrappedBlock();
wrappedBlock.setPlacementInfo(block::getStateForPlacement);
if (item instanceof ItemBlock) {
wrappedBlock.setBlockPlacementLogic(
(stack, player, world, pos, facing, hitX, hitY, hitZ, newState) -> player.canPlayerEdit(pos, facing, stack)
&& world.getBlockState(pos).getBlock().isReplaceable(world, pos)
&& block.canPlaceBlockAt(world, pos) && block.canPlaceBlockOnSide(world, pos, facing)
&& ((ItemBlock) item).placeBlockAt(stack, player, world, pos, facing, hitX, hitY, hitZ, newState));
}
STACK_WRAPPING_MAP.putIfAbsent(item, Pair.of(predicate, Pair.of(wrappedBlock, part)));
return wrappedBlock;
}
代码示例来源:origin: amadornes/MCMultiPart
public boolean placeBlockAtTested(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing facing, float hitX,
float hitY, float hitZ, IBlockState newState) {
return player.canPlayerEdit(pos, facing, stack) && world.getBlockState(pos).getBlock().isReplaceable(world, pos)
&& block.canPlaceBlockAt(world, pos) && block.canPlaceBlockOnSide(world, pos, facing)
&& super.placeBlockAt(stack, player, world, pos, facing, hitX, hitY, hitZ, newState);
}
代码示例来源:origin: MrCrayfish/MrCrayfishFurnitureMod
if(this.block.canPlaceBlockOnSide(world, pos.offset(side), side))
代码示例来源:origin: Vazkii/Quark
if(block.canPlaceBlockOnSide(world, posDown, facing)) {
world.setBlockState(posDown, copyState);
world.playSound(null, posDown.getX(), posDown.getY(), posDown.getZ(), Blocks.LADDER.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, 1F, 1F);
代码示例来源:origin: Glitchfiend/ToughAsNails
if (this.block.canPlaceBlockOnSide(worldIn, pos, side))
内容来源于网络,如有侵权,请联系作者删除!