Fixed BlockBush and BlockCrops not respecting custom soils. Closes #1683

This commit is contained in:
Lex Manos 2015-02-04 12:19:46 -08:00
parent 48c24246a5
commit b036b37a35
3 changed files with 24 additions and 3 deletions

View File

@ -812,8 +812,8 @@
+ public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ IBlockState plant = plantable.getPlant(world, pos.func_177984_a());
+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.func_177984_a());
+ IBlockState plant = plantable.getPlant(world, pos.func_177972_a(direction));
+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.func_177972_a(direction));
+
+ if (plant.func_177230_c() == net.minecraft.init.Blocks.field_150434_aF && this == net.minecraft.init.Blocks.field_150434_aF)
+ {

View File

@ -18,7 +18,19 @@
}
protected boolean func_149854_a(Block p_149854_1_)
@@ -85,4 +85,33 @@
@@ -62,7 +62,10 @@
public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_)
{
- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c());
+ BlockPos down = p_180671_2_.func_177977_b();
+ Block soil = p_180671_1_.func_180495_p(down).func_177230_c();
+ if (p_180671_3_.func_177230_c() != this) return this.func_149854_a(soil); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
+ return soil.canSustainPlant(p_180671_1_, down, net.minecraft.util.EnumFacing.UP, this);
}
public AxisAlignedBB func_180640_a(World p_180640_1_, BlockPos p_180640_2_, IBlockState p_180640_3_)
@@ -85,4 +88,33 @@
{
return EnumWorldBlockLayer.CUTOUT;
}

View File

@ -14,6 +14,15 @@
{
f1 = 3.0F;
}
@@ -127,7 +127,7 @@
public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_)
{
- return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c());
+ return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c().canSustainPlant(p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this);
}
protected Item func_149866_i()
@@ -143,24 +143,6 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
{