Skip to content

Commit

Permalink
Fix trees not replacing grass which causes a floating tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbegt committed Jul 21, 2017
1 parent 842026c commit 559249d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Expand Up @@ -10,8 +10,8 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;
Expand Down Expand Up @@ -42,7 +42,7 @@ public void retroGen(Random random, int chunkX, int chunkZ, World world)
{
this.generateNether(random, chunkX, chunkZ, world);

world.getChunkFromChunkCoords(chunkX, chunkZ).setChunkModified();
world.getChunkFromChunkCoords(chunkX, chunkZ).markDirty();
}

public void generateNether(Random random, int chunkX, int chunkZ, World world)
Expand All @@ -64,7 +64,7 @@ public void generateNether(Random random, int chunkX, int chunkZ, World world)

if (this.shouldGenerateInDimension(world.provider.getDimension()))
{
if (BiomeDictionary.isBiomeOfType(biome, Type.NETHER))
if (BiomeDictionary.hasType(biome, Type.NETHER))
{
if (Config.generateTaintedSoil)
{
Expand Down
Expand Up @@ -14,8 +14,8 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;

public class OverworldTreeGenerator extends BaseTreeGenerator
{
Expand Down Expand Up @@ -229,7 +229,7 @@ protected void placeTrunk(World world, BlockPos pos, int height)
IBlockState state = world.getBlockState(blockpos);
Block block = state.getBlock();

if (block.isAir(state, world, blockpos) || block == null || block.isLeaves(state, world, blockpos))
if (block == null || block.isAir(state, world, pos) || block.isLeaves(state, world, pos) || block.isReplaceable(world, pos))
{
world.setBlockState(blockpos, this.log, 2);
}
Expand Down
Expand Up @@ -15,8 +15,8 @@
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;

public class RedwoodTreeGenerator extends BaseTreeGenerator
{
Expand Down Expand Up @@ -303,7 +303,7 @@ protected void setBlockAndMetadata(World world, BlockPos pos, IBlockState stateN
public boolean isReplaceable(World world, BlockPos pos)
{
IBlockState state = world.getBlockState(pos);
return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos) || state.getBlock().isWood(world, pos) || this.canGrowInto(state.getBlock());
return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos) || state.getBlock().isReplaceable(world, pos) || state.getBlock().isWood(world, pos) || this.canGrowInto(state.getBlock());
}

/**
Expand Down
Expand Up @@ -13,8 +13,8 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;

public class WillowTreeGenerator extends BaseTreeGenerator
{
Expand Down Expand Up @@ -163,7 +163,7 @@ else if (j > position.getY())
IBlockState iblockstate1 = worldIn.getBlockState(upN);
Block block2 = iblockstate1.getBlock();

if (block2.isAir(iblockstate1, worldIn, upN) || block2.isLeaves(iblockstate1, worldIn, upN) || block2 == Blocks.FLOWING_WATER || block2 == Blocks.WATER)
if (block2.isAir(iblockstate1, worldIn, upN) || block2.isLeaves(iblockstate1, worldIn, upN) || block2.isReplaceable(worldIn, upN) || block2 == Blocks.FLOWING_WATER || block2 == Blocks.WATER)
{
this.setBlockAndMetadata(worldIn, position.up(l1), this.log);
}
Expand Down

0 comments on commit 559249d

Please sign in to comment.