use of com.ferreusveritas.dynamictrees.blocks.BlockRooty in project DynamicTrees by DynamicTreesTeam.
the class SubstanceMega method apply.
@Override
public Result apply(World world, BlockPos rootPos, BlockPos hitPos) {
IBlockState blockState = world.getBlockState(rootPos);
BlockRooty dirt = TreeHelper.getRooty(blockState);
Species species = dirt.getSpecies(blockState, world, rootPos);
Species megaSpecies = species.getMegaSpecies();
if (megaSpecies.isValid()) {
int life = dirt.getSoilLife(blockState, world, rootPos);
megaSpecies.placeRootyDirtBlock(world, rootPos, life);
blockState = world.getBlockState(rootPos);
dirt = TreeHelper.getRooty(blockState);
if (dirt.getSpecies(blockState, world, rootPos) == megaSpecies) {
TreeHelper.treeParticles(world, rootPos, EnumParticleTypes.DRAGON_BREATH, 8);
WailaOther.invalidateWailaPosition();
return Result.successful();
}
}
return Result.failure("substance.dynamictrees.mega.error.no_mega_species", species.getLocalizedName());
}
use of com.ferreusveritas.dynamictrees.blocks.BlockRooty in project DynamicTrees by DynamicTreesTeam.
the class SubstanceTransform method apply.
@Override
public Result apply(World world, BlockPos rootPos, BlockPos hitPos) {
IBlockState rootyState = world.getBlockState(rootPos);
BlockRooty dirt = TreeHelper.getRooty(rootyState);
if (this.toSpecies == null) {
return Result.failure("substance.dynamictrees.transform.error.not_brewed");
}
if (dirt == null) {
return Result.failure();
}
final Species fromSpecies = dirt.getSpecies(rootyState, world, rootPos);
if (!fromSpecies.isTransformable()) {
return Result.failure("substance.dynamictrees.transform.error.not_transformable", fromSpecies.getLocalizedName());
}
if (fromSpecies == toSpecies) {
return Result.failure("substance.dynamictrees.transform.error.already_transformed", fromSpecies.getLocalizedName());
}
if (world.isRemote) {
TreeHelper.treeParticles(world, rootPos, EnumParticleTypes.FIREWORKS_SPARK, 8);
WailaOther.invalidateWailaPosition();
} else {
dirt.startAnalysis(world, rootPos, new MapSignal(new NodeTransform(fromSpecies, toSpecies)));
if (dirt.getSpecies(rootyState, world, rootPos) != toSpecies) {
toSpecies.placeRootyDirtBlock(world, rootPos, dirt.getSoilLife(rootyState, world, rootPos));
}
}
return Result.successful();
}
Aggregations