Java Code Examples for net.minecraft.world.World#getBlockState()
The following examples show how to use
net.minecraft.world.World#getBlockState() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WitchWaterBubbleColumnBlock.java From the-hallow with MIT License | 7 votes |
@SuppressWarnings("deprecation") @Override public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { BlockState state2 = world.getBlockState(pos.up()); if (state2.isAir()) { entity.onBubbleColumnSurfaceCollision(state.get(DRAG)); if (!world.isClient) { ServerWorld serverworld = (ServerWorld) world; for (int i = 0; i < 2; i++) { serverworld.spawnParticles(ParticleTypes.SPLASH, (float) pos.getX() + world.random.nextFloat(), pos.getY() + 1, (float) pos.getZ() + world.random.nextFloat(), 1, 0.0D, 0.0D, 0.0D, 1.0D); serverworld.spawnParticles(ParticleTypes.BUBBLE, (float) pos.getX() + world.random.nextFloat(), pos.getY() + 1, (float) pos.getZ() + world.random.nextFloat(), 1, 0.0D, 0.01D, 0.0D, 0.2D); } } } else { entity.onBubbleColumnCollision(state.get(DRAG)); } }
Example 2
Source File: BlockAggregator.java From TofuCraftReload with MIT License | 7 votes |
public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, BlockLoader.TFAGGREGATOR_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFAGGREGATOR_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } else { worldIn.setBlockState(pos, BlockLoader.TFAGGREGATOR.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFAGGREGATOR.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } }
Example 3
Source File: CarpetDispenserBehaviours.java From carpet-extra with GNU Lesser General Public License v3.0 | 7 votes |
@Override protected ItemStack dispenseSilently(BlockPointer source, ItemStack stack) { if(!CarpetExtraSettings.dispensersToggleThings) { return super.dispenseSilently(source, stack); } World world = source.getWorld(); Direction direction = (Direction) source.getBlockState().get(DispenserBlock.FACING); BlockPos pos = source.getBlockPos().offset(direction); BlockState state = world.getBlockState(pos); if(toggleable.contains(state.getBlock())) { ActionResult result = state.onUse( world, null, Hand.MAIN_HAND, new BlockHitResult( new Vec3d(new Vec3i(pos.getX(), pos.getY(), pos.getZ())), direction, pos, false ) ); if(result.isAccepted()) return stack; // success or consume } return super.dispenseSilently(source, stack); }
Example 4
Source File: Wind.java From EmergingTechnology with MIT License | 6 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState north = worldIn.getBlockState(pos.north()); IBlockState east = worldIn.getBlockState(pos.east()); IBlockState south = worldIn.getBlockState(pos.south()); IBlockState west = worldIn.getBlockState(pos.west()); EnumFacing face = (EnumFacing) state.getValue(FACING); if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) { face = EnumFacing.SOUTH; } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) { face = EnumFacing.NORTH; } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) { face = EnumFacing.WEST; } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) { face = EnumFacing.EAST; } worldIn.setBlockState(pos, state.withProperty(FACING, face)); } }
Example 5
Source File: ItemMetalCrackHammer.java From BaseMetals with GNU Lesser General Public License v2.1 | 6 votes |
@Override public boolean onBlockDestroyed(final ItemStack tool, final World world, final IBlockState target, final BlockPos coord, final EntityLivingBase player) { if(!world.isRemote && this.canHarvestBlock(target)){ IBlockState bs = world.getBlockState(coord); ICrusherRecipe recipe = getCrusherRecipe(bs); if(recipe != null){ ItemStack output = recipe.getOutput().copy(); world.setBlockToAir(coord); if(output != null){ int num = output.stackSize; output.stackSize = 1; for(int i = 0; i < num; i++){ world.spawnEntityInWorld(new EntityItem(world, coord.getX()+0.5, coord.getY()+0.5, coord.getZ()+0.5, output.copy())); } } } } return super.onBlockDestroyed(tool, world, target, coord, player); }
Example 6
Source File: BlockTofuStairs.java From TofuCraftReload with MIT License | 6 votes |
/** * Ticks the block if it's been scheduled */ @Override public void updateTick(World par1World, BlockPos pos, IBlockState state, Random par5Random) { super.updateTick(par1World, pos, state, par5Random); if (isFragile) { IBlockState weightBlock = par1World.getBlockState(pos.up()); if (weightBlock != null) { if (weightBlock.getMaterial() == Material.ROCK || weightBlock.getMaterial() == Material.IRON) { dropBlockAsItem(par1World, pos, state, 0); par1World.setBlockToAir(pos); } } } }
Example 7
Source File: UpgradePlanting.java From BetterChests with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void update(IUpgradableBlock chest, ItemStack stack) { if (!UpgradeHelper.INSTANCE.isFirstUpgrade(chest, stack) || chest.getWorldObj().isRemote || !hasUpgradeOperationCost(chest)) { return; } int range = chest.getAmountUpgrades(stack) * 4 + 1; int states = UpgradeHelper.INSTANCE.getFrequencyTick(chest, stack, range * range); int xOffset = states % range - range / 2; int zOffset = states / range - range / 2; World world = chest.getWorldObj(); BlockPos pos = chest.getPosition().add(xOffset, 0, zOffset); if (pos.equals(chest.getPosition())) { return; } IBlockState state = world.getBlockState(pos); if (state.getBlock().isReplaceable(world, pos)) { world.setBlockToAir(pos); } plantBlock((IBetterChest) chest, pos, stack); }
Example 8
Source File: ItemBuildersWand.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
private void setSelectedFixedBlockType(NBTTagCompound tag, EntityPlayer player, World world, BlockPos pos) { IBlockState state = world.getBlockState(pos); tag.setString("BlockName", ForgeRegistries.BLOCKS.getKey(state.getBlock()).toString()); tag.setByte("BlockMeta", (byte)state.getBlock().getMetaFromState(state)); ItemStack stackTmp = state.getBlock().getPickBlock(state, EntityUtils.getRayTraceFromPlayer(world, player, false), world, pos, player); int itemMeta = stackTmp.isEmpty() == false ? stackTmp.getMetadata() : 0; tag.setShort("ItemMeta", (short)itemMeta); }
Example 9
Source File: DebugModeTestBlockRange.java From AgriCraft with MIT License | 5 votes |
/** * This method allows the user to test what Block Positions are covered by the BlockRange * iterator. The expected result will be the full cuboid between opposing corner positions. Also * remember that the BlockRange min and max positions aren't necessarily the input positions. * * Usage: Right-click on two blocks to specify the opposite corners. Some blocks should get * replaced with free wool. Be careful. In case of terrible bugs, might destroy or overwrite * unexpected locations! */ @Override public void debugActionBlockClicked(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (world.isRemote) { return; } Optional<BlockPos> startPos = getStartPos(stack); if (!startPos.isPresent()) { // This is the first click. Save 'pos' as the starting coordinate. setStartPos(stack, pos); player.sendMessage(new TextComponentString("Starting corner set: (" + pos.getX() + "," + pos.getY() + "," + pos.getZ() + ")")); player.sendMessage(new TextComponentString("Next right click will set the opposite/ending corner.")); player.sendMessage(new TextComponentString("WARNING: this mode will destroy blocks, be careful.")); } else { // This is the second click. Load the starting coordinate. Use 'pos' as the ending coordinate. Then fill the cuboid with wool. int count = 0; IBlockState wool = Blocks.WOOL.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.BLACK); // // IMPORTANT PART OF THE TEST IS BELOW // BlockRange range = new BlockRange(startPos.get(), pos); for (BlockPos target : range) { // <-- Is the iterator giving a complete set? IBlockState old = world.getBlockState(target); world.destroyBlock(target, true); world.setBlockState(target, wool); world.notifyBlockUpdate(target, old, wool, 2); count += 1; } // // IMPORTANT PART OF THE TEST IS ABOVE // player.sendMessage(new TextComponentString("Volume: " + range.getVolume())); player.sendMessage(new TextComponentString("Replaced: " + count)); player.sendMessage(new TextComponentString("Coverage: " + (range.getVolume() == count ? "Complete" : "INCOMPLETE"))); setStartPos(stack, null); } }
Example 10
Source File: ItemSoybeansNether.java From TofuCraftReload with MIT License | 5 votes |
@Override public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack item = playerIn.getHeldItem(hand); if(item.getItem() == this &&!item.isEmpty()) { if (side != EnumFacing.UP) { return EnumActionResult.PASS; } else if (playerIn.canPlayerEdit(pos, side, item) && playerIn.canPlayerEdit(pos.up(), side, item)) { IBlockState soil = worldIn.getBlockState(pos); if (soil != null && worldIn.isAirBlock(pos.up())) { boolean isPlanted = false; if (soil.getBlock() == BlockLoader.TOFUFARMLAND||soil.getBlock()==Blocks.SOUL_SAND) { worldIn.setBlockState(pos.up(), BlockLoader.SOYBEAN_NETHER.getDefaultState()); isPlanted = true; } if (isPlanted) { item.shrink(1); return EnumActionResult.SUCCESS; } else { return EnumActionResult.PASS; } } else { return EnumActionResult.PASS; } //return EnumActionResult.PASS; } return EnumActionResult.PASS; } else { return EnumActionResult.PASS; } }
Example 11
Source File: CivilizationHandlers.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
private BlockPos findSpawnLocationFrom(World world, BlockPos from) { BlockPos spawnPos = from.add(0, 20, 0); boolean[] airSpace = { false, false }; IBlockState blockState; // TODO improve so sentries don't always spawn at the highest possible // location for (int i = 0; i < 40; i++) { blockState = world.getBlockState(spawnPos); if (isAir(blockState)) { if (airSpace[0]) { airSpace[1] = true; } else { airSpace[0] = true; } } else if (isGroundBlock(blockState)) { if (airSpace[0] && airSpace[1]) { return spawnPos.up(); } else { airSpace[0] = false; airSpace[1] = false; } } else { airSpace[0] = false; airSpace[1] = false; } spawnPos = spawnPos.down(); } return null; }
Example 12
Source File: TileEntityFluidPipe.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
public static void setNeighboursToFire(World world, BlockPos selfPos) { for (EnumFacing side : EnumFacing.VALUES) { if (!random.nextBoolean()) continue; BlockPos blockPos = selfPos.offset(side); IBlockState blockState = world.getBlockState(blockPos); if (blockState.getBlock().isAir(blockState, world, blockPos) || blockState.getBlock().isFlammable(world, blockPos, side.getOpposite())) { world.setBlockState(blockPos, Blocks.FIRE.getDefaultState()); } } }
Example 13
Source File: BlockValkyriumOre.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
private void tryFallingUp(World worldIn, BlockPos pos) { BlockPos downPos = pos.up(); if ((worldIn.isAirBlock(downPos) || canFallThrough(worldIn.getBlockState(downPos))) && pos.getY() >= 0) { int i = 32; if (!BlockFalling.fallInstantly && worldIn .isAreaLoaded(pos.add(-32, -32, -32), pos.add(32, 32, 32))) { if (!worldIn.isRemote) { // Start falling up EntityFallingUpBlock entityfallingblock = new EntityFallingUpBlock(worldIn, (double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D, worldIn.getBlockState(pos)); worldIn.spawnEntity(entityfallingblock); } } else { IBlockState state = worldIn.getBlockState(pos); worldIn.setBlockToAir(pos); BlockPos blockpos; for (blockpos = pos.up(); (worldIn.isAirBlock(blockpos) || canFallThrough( worldIn.getBlockState(blockpos))) && blockpos.getY() < 255; blockpos = blockpos.up()) { } if (blockpos.getY() < 255) { worldIn.setBlockState(blockpos.down(), state, 3); } } } }
Example 14
Source File: ItemChestUpgrade.java From BetterChests with GNU Lesser General Public License v3.0 | 5 votes |
@Override public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { if (world.isRemote) { return EnumActionResult.PASS; } IBlockState state = world.getBlockState(pos); TileEntity te = world.getTileEntity(pos); if (state.getBlock() == Blocks.CHEST && te instanceof TileEntityChest) { TileEntityChest chest = (TileEntityChest) te; ItemStack[] items = new ItemStack[chest.getSizeInventory()]; for (int i = 0; i < items.length; i++) { items[i] = chest.getStackInSlot(i); chest.setInventorySlotContents(i, ItemStack.EMPTY); } IBlockState newState = BlocksItemsBetterChests.betterchest.getDefaultState().withProperty(BlockBetterChest.directions, state.getValue(BlockChest.FACING)); world.setBlockState(pos, newState, 2); TileEntityBChest newte = new TileEntityBChest(); world.setTileEntity(pos, newte); for (int i = 0; i < items.length; i++) { newte.getChestPart().setInventorySlotContents(i, items[i]); } world.notifyBlockUpdate(pos, state, newState, 1); ItemStack heldItem = player.getHeldItem(hand); heldItem.setCount(heldItem.getCount() - 1); return EnumActionResult.SUCCESS; } return EnumActionResult.PASS; }
Example 15
Source File: BlockAdvancedAggregator.java From TofuCraftReload with MIT License | 5 votes |
private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState iblockstate = worldIn.getBlockState(pos.north()); IBlockState iblockstate1 = worldIn.getBlockState(pos.south()); IBlockState iblockstate2 = worldIn.getBlockState(pos.west()); IBlockState iblockstate3 = worldIn.getBlockState(pos.east()); EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock()) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock()) { enumfacing = EnumFacing.NORTH; } else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock()) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock()) { enumfacing = EnumFacing.WEST; } worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); } }
Example 16
Source File: Ladder.java From EmergingTechnology with MIT License | 4 votes |
private boolean canAttachTo(World world, BlockPos pos, EnumFacing facing) { IBlockState iblockstate = world.getBlockState(pos); boolean flag = isExceptBlockForAttachWithPiston(iblockstate.getBlock()); return !flag && iblockstate.getBlockFaceShape(world, pos, facing) == BlockFaceShape.SOLID && !iblockstate.canProvidePower(); }
Example 17
Source File: EntityBlock.java From OpenModsLib with MIT License | 4 votes |
public static EntityBlock create(EntityLivingBase creator, World world, BlockPos pos, EntityFactory factory) { if (world.isAirBlock(pos)) return null; if (!(creator instanceof EntityPlayer)) return null; final EntityPlayer player = (EntityPlayer)creator; final EntityBlock entity = factory.create(world); entity.blockState = world.getBlockState(pos); final TileEntity te = world.getTileEntity(pos); if (te != null) { entity.tileEntity = te.writeToNBT(new NBTTagCompound()); } final boolean blockRemoved = new BlockManipulator(world, player, pos).setSilentTeRemove(true).remove(); if (!blockRemoved) return null; entity.setPositionAndRotation(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0, 0); return entity; }
Example 18
Source File: WorldGenTofuTrees.java From TofuCraftReload with MIT License | 4 votes |
public boolean generate(World worldIn, Random rand, BlockPos position) { int i = rand.nextInt(3) + 4; boolean flag = true; if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) { for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) { int k = 1; if (j == position.getY()) { k = 0; } if (j >= position.getY() + 1 + i - 2) { k = 2; } BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) { for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) { if (j >= 0 && j < worldIn.getHeight()) { if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.setPos(l, j, i1))) { flag = false; } } else { flag = false; } } } } if (!flag) { return false; } else { IBlockState state = worldIn.getBlockState(position.down()); int j1; if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, BlockLoader.TOFU_SAPLING) && position.getY() < worldIn.getHeight() - i - 1) { state.getBlock().onPlantGrow(state, worldIn, position.down(), position); for (int i3 = position.getY() - 3 + i; i3 <= position.getY() + i; ++i3) { j1 = i / 3; for (int k1 = position.getX() - j1; k1 <= position.getX() + j1; ++k1) { for (int i2 = position.getZ() - j1; i2 <= position.getZ() + j1; ++i2) { BlockPos blockpos = new BlockPos(k1, i3, i2); state = worldIn.getBlockState(blockpos); if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) { this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLoader.TOFU_LEAVE.getDefaultState()); } } } } for (int j3 = 0; j3 < i; ++j3) { BlockPos upN = position.up(j3); state = worldIn.getBlockState(upN); if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) { this.setBlockAndNotifyAdequately(worldIn, position.up(j3), BlockLoader.ISHITOFU.getDefaultState()); } } return true; } else { return false; } } } else { return false; } }
Example 19
Source File: BlockPress.java From AdvancedRocketry with MIT License | 4 votes |
private boolean doMove(World worldIn, BlockPos pos, EnumFacing direction, boolean extending) { if (!extending) { worldIn.setBlockToAir(pos.offset(direction)); } BlockPistonStructureHelper blockpistonstructurehelper = new BlockPistonStructureHelper(worldIn, pos, direction, extending); if (!blockpistonstructurehelper.canMove()) { return false; } else { List<BlockPos> list = blockpistonstructurehelper.getBlocksToMove(); List<IBlockState> list1 = Lists.<IBlockState>newArrayList(); for (int i = 0; i < list.size(); ++i) { BlockPos blockpos = (BlockPos)list.get(i); list1.add(worldIn.getBlockState(blockpos).getActualState(worldIn, blockpos)); } List<BlockPos> list2 = blockpistonstructurehelper.getBlocksToDestroy(); int k = list.size() + list2.size(); IBlockState[] aiblockstate = new IBlockState[k]; EnumFacing enumfacing = extending ? direction : direction.getOpposite(); for (int j = list2.size() - 1; j >= 0; --j) { BlockPos blockpos1 = (BlockPos)list2.get(j); IBlockState iblockstate = worldIn.getBlockState(blockpos1); // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. float chance = iblockstate.getBlock() instanceof BlockSnow ? -1.0f : 1.0f; iblockstate.getBlock().dropBlockAsItemWithChance(worldIn, blockpos1, iblockstate, chance, 0); worldIn.setBlockToAir(blockpos1); --k; aiblockstate[k] = iblockstate; } for (int l = list.size() - 1; l >= 0; --l) { BlockPos blockpos3 = (BlockPos)list.get(l); IBlockState iblockstate2 = worldIn.getBlockState(blockpos3); worldIn.setBlockState(blockpos3, Blocks.AIR.getDefaultState(), 2); blockpos3 = blockpos3.offset(enumfacing); worldIn.setBlockState(blockpos3, Blocks.PISTON_EXTENSION.getDefaultState().withProperty(FACING, direction), 4); worldIn.setTileEntity(blockpos3, BlockPistonMoving.createTilePiston((IBlockState)list1.get(l), direction, extending, false)); --k; aiblockstate[k] = iblockstate2; } BlockPos blockpos2 = pos.offset(direction); if (extending) { BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = BlockPistonExtension.EnumPistonType.DEFAULT; IBlockState iblockstate3 = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.FACING, direction).withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype); IBlockState iblockstate1 = Blocks.PISTON_EXTENSION.getDefaultState().withProperty(BlockPistonMoving.FACING, direction).withProperty(BlockPistonMoving.TYPE, BlockPistonExtension.EnumPistonType.DEFAULT); worldIn.setBlockState(blockpos2, iblockstate1, 4); worldIn.setTileEntity(blockpos2, BlockPistonMoving.createTilePiston(iblockstate3, direction, true, false)); } for (int i1 = list2.size() - 1; i1 >= 0; --i1) { worldIn.notifyNeighborsOfStateChange((BlockPos)list2.get(i1), aiblockstate[k++].getBlock(), true); } for (int j1 = list.size() - 1; j1 >= 0; --j1) { worldIn.notifyNeighborsOfStateChange((BlockPos)list.get(j1), aiblockstate[k++].getBlock(), true); } if (extending) { worldIn.notifyNeighborsOfStateChange(blockpos2, Blocks.PISTON_HEAD, true); worldIn.notifyNeighborsOfStateChange(pos, this, true); } return true; } }
Example 20
Source File: BlockFrame.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
protected boolean canBlockStay(World worldIn, BlockPos pos) { MutableBlockPos currentPos = new MutableBlockPos(pos); currentPos.move(EnumFacing.DOWN); IBlockState downState = worldIn.getBlockState(currentPos); if (downState.getBlock() instanceof BlockFrame) { if (canFrameSupportVertical(worldIn, currentPos)) { return true; } } else if (downState.getBlockFaceShape(worldIn, currentPos, EnumFacing.UP) == BlockFaceShape.SOLID) { return true; } currentPos.move(EnumFacing.UP); HashSet<BlockPos> observedSet = new HashSet<>(); Stack<EnumFacing> moveStack = new Stack<>(); main: while (true) { for (EnumFacing facing : EnumFacing.HORIZONTALS) { currentPos.move(facing); IBlockState blockStateHere = worldIn.getBlockState(currentPos); //if there is node, and it can connect with previous node, add it to list, and set previous node as current if (blockStateHere.getBlock() instanceof BlockFrame && currentPos.distanceSq(pos) <= SCAFFOLD_PILLAR_RADIUS_SQ && !observedSet.contains(currentPos)) { observedSet.add(currentPos.toImmutable()); currentPos.move(EnumFacing.DOWN); downState = worldIn.getBlockState(currentPos); if (downState.getBlock() instanceof BlockFrame) { if (canFrameSupportVertical(worldIn, currentPos)) { return true; } } else if (downState.getBlockFaceShape(worldIn, currentPos, EnumFacing.UP) == BlockFaceShape.SOLID) { return true; } currentPos.move(EnumFacing.UP); moveStack.push(facing.getOpposite()); continue main; } else currentPos.move(facing.getOpposite()); } if (!moveStack.isEmpty()) { currentPos.move(moveStack.pop()); } else break; } return false; }