use of com.ferreusveritas.dynamictrees.blocks.BlockSurfaceRoot in project DynamicTrees by DynamicTreesTeam.
the class ChunkTreeHelper method cleanupBlock.
/**
* Cleanup blocks that are attached(or setting on) various parts of the tree
*
* @param world
* @param pos
*/
public static void cleanupBlock(World world, BlockPos pos) {
IBlockState blockstate = world.getBlockState(pos);
if (blockstate == ModBlocks.blockStates.air) {
// This is the most likely case so bail early
return;
}
Block block = blockstate.getBlock();
// Cleanup snow layers, hanging fruit(apples), trunk fruit(cocoa), and surface roots.
if (block instanceof BlockSnow || block instanceof BlockFruit || block instanceof BlockFruitCocoa || block instanceof BlockSurfaceRoot) {
world.setBlockState(pos, ModBlocks.blockStates.air, 2);
} else // Cleanup vines
if (block instanceof BlockVine) {
cleanupVines(world, pos);
}
}
use of com.ferreusveritas.dynamictrees.blocks.BlockSurfaceRoot in project DynamicTrees by DynamicTreesTeam.
the class FeatureGenRoots method postGrow.
@Override
public boolean postGrow(World world, BlockPos rootPos, BlockPos treePos, Species species, int soilLife, boolean natural) {
int trunkRadius = TreeHelper.getRadius(world, treePos);
if (soilLife > 0 && trunkRadius >= minTrunkRadius) {
Surround surr = Surround.values()[world.rand.nextInt(8)];
BlockPos dPos = treePos.add(surr.getOffset());
if (world.getBlockState(dPos).getBlock() instanceof BlockSurfaceRoot) {
world.setBlockState(dPos, ModBlocks.blockTrunkShell.getDefaultState().withProperty(BlockTrunkShell.COREDIR, surr.getOpposite()));
}
startRoots(world, treePos, species, trunkRadius);
}
return true;
}
use of com.ferreusveritas.dynamictrees.blocks.BlockSurfaceRoot in project DynamicTrees by DynamicTreesTeam.
the class ModelHelper method regModel.
/**
* Registers models associated with the tree. At the moment this only deals with {@link BlockBranch} blocks
*
* @param tree
*/
public static void regModel(TreeFamily tree) {
BlockBranch blockBranch = tree.getDynamicBranch();
ModelResourceLocation modelLocation = getBranchModelResourceLocation(blockBranch);
setGenericStateMapper(blockBranch, modelLocation);
if (blockBranch instanceof BlockBranchThick) {
setGenericStateMapper(((BlockBranchThick) blockBranch).otherBlock, modelLocation);
}
BlockSurfaceRoot surfaceRoot = tree.getSurfaceRoots();
if (surfaceRoot != null) {
ModelLoader.setCustomStateMapper(surfaceRoot, new StateMap.Builder().ignore(surfaceRoot.getIgnorableProperties()).build());
}
}
Aggregations