use of com.ferreusveritas.dynamictrees.blocks.leaves.DynamicLeavesBlock in project minecolonies by Minecolonies.
the class DynamicTreeCompat method getDropsForLeaf.
/**
* Returns drops of a dynamic seed as List
*
* @param world world the Leaf is in
* @param pos position of the Leaf
* @param blockState Blockstate of the Leaf
* @param fortune amount of fortune to use
* @param leaf The leaf to check
*/
@Override
public NonNullList<ItemStack> getDropsForLeaf(@NotNull final IWorld world, @NotNull final BlockPos pos, @NotNull final BlockState blockState, final int fortune, @NotNull final Block leaf) {
if (isDynamicLeavesBlock(leaf)) {
ItemStack stack = ((DynamicLeavesBlock) leaf).getFamily(blockState, world, pos).getCommonSpecies().getSeedStack(1);
final NonNullList<ItemStack> list = NonNullList.create();
list.add(stack);
return list;
}
return NonNullList.create();
}
use of com.ferreusveritas.dynamictrees.blocks.leaves.DynamicLeavesBlock in project DynamicTrees-BYG by DynamicTreesTeam.
the class DiagonalPalmFamily method createBranchBlock.
@Override
protected BranchBlock createBranchBlock() {
final BasicBranchBlock branch = new BasicBranchBlock(this.getProperties()) {
@Override
public GrowSignal growIntoAir(World world, BlockPos pos, GrowSignal signal, int fromRadius) {
final Species species = signal.getSpecies();
final DynamicLeavesBlock leaves = species.getLeavesBlock().orElse(null);
if (leaves != null) {
if (fromRadius == getFamily().getPrimaryThickness()) {
// If we came from a twig (and we're not a stripped branch) then just make some leaves
if (isNextToBranch(world, pos, signal.dir.getOpposite())) {
signal.success = false;
return signal;
}
signal.success = leaves.growLeavesIfLocationIsSuitable(world, species.getLeavesProperties(), pos.above(), 0);
if (signal.success)
return leaves.branchOut(world, pos, signal);
} else {
// Otherwise make a proper branch
return leaves.branchOut(world, pos, signal);
}
} else {
// If the leaves block is null, the branch grows directly without checking for leaves requirements
if (isNextToBranch(world, pos, signal.dir.getOpposite())) {
signal.success = false;
return signal;
}
setRadius(world, pos, getFamily().getPrimaryThickness(), null);
signal.radius = getFamily().getSecondaryThickness();
signal.success = true;
}
return signal;
}
};
if (this.isFireProof())
branch.setFireSpreadSpeed(0).setFlammability(0);
return branch;
}
use of com.ferreusveritas.dynamictrees.blocks.leaves.DynamicLeavesBlock in project minecolonies by ldtteam.
the class DynamicTreeCompat method getDropsForLeaf.
/**
* Returns drops of a dynamic seed as List
*
* @param world world the Leaf is in
* @param pos position of the Leaf
* @param blockState Blockstate of the Leaf
* @param fortune amount of fortune to use
* @param leaf The leaf to check
*/
@Override
public NonNullList<ItemStack> getDropsForLeaf(@NotNull final IWorld world, @NotNull final BlockPos pos, @NotNull final BlockState blockState, final int fortune, @NotNull final Block leaf) {
if (isDynamicLeavesBlock(leaf)) {
ItemStack stack = ((DynamicLeavesBlock) leaf).getFamily(blockState, world, pos).getCommonSpecies().getSeedStack(1);
final NonNullList<ItemStack> list = NonNullList.create();
list.add(stack);
return list;
}
return NonNullList.create();
}
Aggregations