List of usage examples for net.minecraftforge.common.util BlockSnapshot getCurrentBlock
public BlockState getCurrentBlock()
From source file:hellfirepvp.astralsorcery.common.tile.TileTreeBeacon.java
License:Open Source License
private boolean updatePositionsFromSnapshots(World world, WorldBlockPos saplingPos, BlockPos origin) { boolean ret = false; if (!TreeCaptureHelper.oneTimeCatches.remove(saplingPos) && !world.capturedBlockSnapshots.isEmpty() && world.capturedBlockSnapshots.size() > 2) { //I guess then something grew after all? if (treePositions.getSize() + world.capturedBlockSnapshots.size() <= ConfigEntryTreeBeacon.maxCount) { for (BlockSnapshot snapshot : world.capturedBlockSnapshots) { IBlockState setBlock = snapshot.getCurrentBlock(); if (!setBlock.getBlock().equals(BlocksAS.blockFakeTree) && !setBlock.getBlock().equals(Blocks.DIRT) && !setBlock.getBlock().equals(Blocks.GRASS)) { world.setBlockState(snapshot.getPos(), BlocksAS.blockFakeTree.getDefaultState()); TileFakeTree tft = MiscUtils.getTileAt(world, snapshot.getPos(), TileFakeTree.class, true); if (tft != null) { tft.setupTile(origin, setBlock); }/*from w ww . j a v a 2 s. c o m*/ if (treePositions.offerElement(snapshot.getPos())) ret = true; } } } else { for (BlockSnapshot snapshot : world.capturedBlockSnapshots) { IBlockState current = world.getBlockState(snapshot.getPos()); world.notifyBlockUpdate(snapshot.getPos(), current, current, 3); } } } world.capturedBlockSnapshots.clear(); return ret; }