/** * Determines if a block side can contain a glow. * Returns true if the block side is solid and the block at the given BlockPos is not a liquid */ protected boolean canBlockStay(World world, BlockPos pos, EnumFacing facing) { BlockPos placedOn = pos.offset(facing); boolean isSolidSide = world.getBlockState(placedOn).isSideSolid(world, placedOn, facing.getOpposite()); boolean isLiquid = world.getBlockState(pos).getBlock() instanceof BlockLiquid; return !isLiquid && isSolidSide; }
@Override public boolean isSideSolid( BlockPos pos, EnumFacing side, boolean _default ) { if( pos.getX() < -30000000 || pos.getZ() < -30000000 || pos.getX() >= 30000000 || pos.getZ() >= 30000000 ) { return _default; } else { return this.getBlockState( pos ).isSideSolid( this, pos, side ); } } }
if(!adjState.isSideSolid(world, adjPos, dir.getOpposite())) { coordsList.add(pos_); break;
@Override public boolean isSideSolid(@Nonnull IBlockAccess world1, @Nonnull BlockPos pos1, @Nonnull EnumFacing side) { return state.isSideSolid(world1, pos1, side); }
IBlockState state = supertile.getWorld().getBlockState(supertile.getPos()); supertile.getWorld().playEvent(2001, supertile.getPos(), Block.getStateId(state)); if(supertile.getWorld().getBlockState(supertile.getPos().down()).isSideSolid(supertile.getWorld(), supertile.getPos().down(), EnumFacing.UP)) supertile.getWorld().setBlockState(supertile.getPos(), Blocks.DEADBUSH.getDefaultState()); else supertile.getWorld().setBlockToAir(supertile.getPos());
@Override public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) { return getBlockState(pos).isSideSolid(this, pos, side); } }
@Override public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) { return this.getBlockState(pos).isSideSolid(this, pos, side); } }
@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos.down()); return iblockstate.isSideSolid(worldIn, pos, EnumFacing.UP); }
protected boolean canMakeSnow(@Nonnull World world, final @Nonnull BlockPos neighborPos, final @Nonnull IBlockState neighborState) { final BlockPos belowNeighborPos = neighborPos.down(); final Block neighborBlock = neighborState.getBlock(); return neighborBlock != Blocks.SNOW_LAYER && !(neighborBlock instanceof IFluidBlock) && !(neighborBlock instanceof BlockLiquid) && neighborBlock.isReplaceable(world, neighborPos) && world.getBlockState(belowNeighborPos).isSideSolid(world, belowNeighborPos, EnumFacing.UP); }
/** * Check whether this block can be placed on the block in the given direction. */ private static boolean canPlaceBlock(World worldIn, BlockPos pos, EnumFacing direction) { BlockPos blockpos = pos.offset(direction); return worldIn.getBlockState(blockpos).isSideSolid(worldIn, blockpos, direction.getOpposite()); }
@Override public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side) { BlockPos offsetPos = pos.offset(side.getOpposite()); IBlockState offsetState = world.getBlockState(offsetPos); return offsetState.isSideSolid(world, offsetPos, side) && this.canPlaceBlockAt(world, pos); }
public static void generateMushrooms(World worldIn, BlockPos blockpos, BlockPos origin, int radius, Random rand) { if (worldIn.getBlockState(blockpos.down()).isSideSolid(worldIn, blockpos.down(), EnumFacing.UP)) { worldIn.setBlockState(blockpos, rand.nextBoolean() ? Blocks.BROWN_MUSHROOM.getDefaultState() : Blocks.RED_MUSHROOM.getDefaultState()); } }
public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) { BlockPos off = pos.offset(dir); IBlockState state = world.getBlockState(off); return canPaneConnectToBlock(state.getBlock()) || state.isSideSolid(world, off, dir.getOpposite()); }
@Override public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) { if (pos.getX() < -30000000 || pos.getZ() < -30000000 || pos.getX() >= 30000000 || pos.getZ() >= 30000000) { return _default; } else { return getBlockState(pos).isSideSolid(this, pos, side); } } }
@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return super.canPlaceBlockAt(worldIn, pos) && (downState.isSideSolid(worldIn, pos, EnumFacing.UP) || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID); }
@Override public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileDemonCrystal) { TileDemonCrystal crystal = (TileDemonCrystal) tile; EnumFacing placement = crystal.getPlacement(); BlockPos offsetPos = pos.offset(placement.getOpposite()); IBlockState offsetState = world.getBlockState(offsetPos); if (!offsetState.isSideSolid(world, offsetPos, placement)) world.destroyBlock(pos, true); } }
public static void generateCocoon(World worldIn, BlockPos blockpos, Random rand, boolean jungle, ResourceLocation lootTable) { if (worldIn.getBlockState(blockpos.down()).isSideSolid(worldIn, blockpos.down(), EnumFacing.UP)) { worldIn.setBlockState(blockpos, jungle ? ModBlocks.jungle_myrmex_cocoon.getDefaultState() : ModBlocks.desert_myrmex_cocoon.getDefaultState(), 3); if (worldIn.getTileEntity(blockpos) != null && worldIn.getTileEntity(blockpos) instanceof TileEntityLockableLoot && !((TileEntityLockableLoot) worldIn.getTileEntity(blockpos)).isInvalid()) { TileEntity tileentity1 = worldIn.getTileEntity(blockpos); ((TileEntityLockableLoot) tileentity1).setLootTable(lootTable, rand.nextLong()); } } }
protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) { boolean solid = facing.getAxis() != Axis.Y && worldIn.getBlockState(pos.offset(facing.getOpposite())).isSideSolid(worldIn, pos.offset(facing.getOpposite()), facing); IBlockState topState = worldIn.getBlockState(pos.up()); return solid || (topState.getBlock() == this && (facing.getAxis() == Axis.Y || topState.getValue(FACING) == facing)); }
protected void interactWithBlock(World world, BlockPos pos) { IBlockState state = world.getBlockState(pos); if (state.getBlock().isAir(state, world, pos) || state.getBlock() == this) { return; } if (hasInteraction(state)) { world.setBlockState(pos, getInteraction(state), 3); } else if (state.isSideSolid(world, pos, EnumFacing.UP) && world.isAirBlock(pos.offset(EnumFacing.UP))) { world.setBlockState(pos.offset(EnumFacing.UP), Blocks.SNOW_LAYER.getDefaultState(), 3); } }
private void attemptToTeleportToSafety(BlockPos go) { Vec3d vec = RandomPositionGenerator.findRandomTargetBlockTowards(npc, 3, 32, new Vec3d((double) go.getX() + 0.5D, (double) go.getY() + 1D, (double) go.getZ() + 0.5D)); if (vec != null) { BlockPos pos = new BlockPos(vec); if (EntityHelper.isSpawnable(npc.world, pos) && EntityHelper.isSpawnable(npc.world, pos.up()) && npc.world.getBlockState(pos.down()).isSideSolid(npc.world, pos.down(), EnumFacing.UP)) { npc.setPositionAndUpdate(pos.getX() + 0.5D, pos.getY() + 1D, pos.getZ() + 0.5D); } } }