ForgePatch/patches/minecraft/net/minecraft/block/BlockBush.java.patch

70 lines
3.9 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java
@@ -17,7 +17,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockBush extends Block
+public class BlockBush extends Block implements net.minecraftforge.common.IPlantable
{
protected static final AxisAlignedBB field_185515_b = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D);
@@ -40,7 +40,8 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
{
- return super.func_176196_c(p_176196_1_, p_176196_2_) && this.func_185514_i(p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()));
+ IBlockState soil = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b());
+ return super.func_176196_c(p_176196_1_, p_176196_2_) && soil.func_177230_c().canSustainPlant(soil, p_176196_1_, p_176196_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this);
}
protected boolean func_185514_i(IBlockState p_185514_1_)
@@ -70,6 +71,11 @@
public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_)
{
+ if (p_180671_3_.func_177230_c() == this) //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.
+ {
+ IBlockState soil = p_180671_1_.func_180495_p(p_180671_2_.func_177977_b());
+ return soil.func_177230_c().canSustainPlant(soil, p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this);
+ }
return this.func_185514_i(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()));
}
@@ -94,6 +100,35 @@
return false;
}
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ if (this == Blocks.field_150464_aj) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_150459_bM) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_150469_bN) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_150394_bc) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_150393_bb) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.field_150330_I) return net.minecraftforge.common.EnumPlantType.Desert;
+ if (this == Blocks.field_150392_bi) return net.minecraftforge.common.EnumPlantType.Water;
+ if (this == Blocks.field_150337_Q) return net.minecraftforge.common.EnumPlantType.Cave;
+ if (this == Blocks.field_150338_P) return net.minecraftforge.common.EnumPlantType.Cave;
+ if (this == Blocks.field_150388_bm) return net.minecraftforge.common.EnumPlantType.Nether;
+ if (this == Blocks.field_150345_g) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.field_150329_H) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.field_150398_cm) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.field_150328_O) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.field_150327_N) return net.minecraftforge.common.EnumPlantType.Plains;
+ return net.minecraftforge.common.EnumPlantType.Plains;
+ }
+
+ @Override
+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ if (state.func_177230_c() != this) return func_176223_P();
+ return state;
+ }
+
@SideOnly(Side.CLIENT)
public BlockRenderLayer func_180664_k()
{