Fixed trees not growing around ground foliage (Closes #1461)

This commit is contained in:
Forstride 2019-08-23 02:23:48 -04:00
parent 5b025fb267
commit 4fc7f77f34
5 changed files with 67 additions and 10 deletions

View File

@ -10,11 +10,9 @@ package biomesoplenty.common.world.gen.feature.tree;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.util.biome.GeneratorUtil;
import biomesoplenty.common.util.block.IBlockPosQuery;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SaplingBlock;
import net.minecraft.block.SeaGrassBlock;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@ -37,7 +35,7 @@ public class CypressTreeFeature extends TreeFeatureBase
this.minHeight = 6;
this.maxHeight = 15;
this.placeOn = (world, pos) -> world.getBlockState(pos).canSustainPlant(world, pos, Direction.UP, (SaplingBlock)Blocks.OAK_SAPLING);
this.replace = (world, pos) -> world.getBlockState(pos).canBeReplacedByLeaves(world, pos) || world.getBlockState(pos).getMaterial() == Material.WATER;
this.replace = (world, pos) -> world.getBlockState(pos).canBeReplacedByLeaves(world, pos) || world.getBlockState(pos).getMaterial() == Material.WATER || world.getBlockState(pos).getBlock().isIn(BlockTags.SAPLINGS) || world.getBlockState(pos).getBlock() == Blocks.VINE || world.getBlockState(pos).getBlock() == BOPBlocks.willow_vine || world.getBlockState(pos).getBlock() instanceof BushBlock;
this.log = BOPBlocks.willow_log.getDefaultState();
this.leaves = BOPBlocks.willow_leaves.getDefaultState();
this.vine = BOPBlocks.willow_vine.getDefaultState();

View File

@ -7,13 +7,12 @@
******************************************************************************/
package biomesoplenty.common.world.gen.feature.tree;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.util.block.BlockUtil;
import biomesoplenty.common.util.block.IBlockPosQuery;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SaplingBlock;
import net.minecraft.block.VineBlock;
import net.minecraft.block.*;
import net.minecraft.state.IProperty;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MutableBoundingBox;
@ -44,7 +43,7 @@ public abstract class TreeFeatureBase extends AbstractTreeFeature<NoFeatureConfi
public BuilderBase()
{
this.placeOn = (world, pos) -> world.getBlockState(pos).canSustainPlant(world, pos, Direction.UP, (SaplingBlock)Blocks.OAK_SAPLING);
this.replace = (world, pos) -> world.getBlockState(pos).canBeReplacedByLeaves(world, pos);
this.replace = (world, pos) -> world.getBlockState(pos).canBeReplacedByLeaves(world, pos) || world.getBlockState(pos).getBlock().isIn(BlockTags.SAPLINGS) || world.getBlockState(pos).getBlock() == Blocks.VINE || world.getBlockState(pos).getBlock() == BOPBlocks.willow_vine || world.getBlockState(pos).getBlock() instanceof BushBlock;
this.log = Blocks.OAK_LOG.getDefaultState();
this.leaves = Blocks.OAK_LEAVES.getDefaultState();
this.vine = Blocks.AIR.getDefaultState();

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"minecraft:mossy_cobblestone"
]
},
"criteria": {
"has_vine": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "biomesoplenty:willow_vine"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "minecraft:mossy_cobblestone"
}
}
},
"requirements": [
[
"has_vine",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "minecraft:cobblestone"
},
{
"item": "biomesoplenty:willow_vine"
}
],
"result": {
"item": "minecraft:mossy_cobblestone"
}
}

View File

@ -0,0 +1,14 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "minecraft:stone_bricks"
},
{
"item": "biomesoplenty:willow_vine"
}
],
"result": {
"item": "minecraft:mossy_stone_bricks"
}
}