<commit_before>--- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java
@@ -24,7 +24,7 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
-public class BlockDoublePlant extends BlockBush implements IGrowable
+public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable
 {
     public static final PropertyEnum field_176493_a = PropertyEnum.func_177709_a("variant", BlockDoublePlant.EnumPlantType.class);
     public static final PropertyEnum field_176492_b = PropertyEnum.func_177709_a("half", BlockDoublePlant.EnumBlockHalf.class);
@@ -89,6 +89,8 @@
             Object object = flag ? this : p_176475_1_.func_180495_p(blockpos1).func_177230_c();
             Object object1 = flag ? p_176475_1_.func_180495_p(blockpos2).func_177230_c() : this;
 
+            if (!flag) this.func_176226_b(p_176475_1_, p_176475_2_, p_176475_3_, 0); //Forge move above the setting to air.
+
             if (object == this)
             {
                 p_176475_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3);
@@ -97,17 +99,13 @@
             if (object1 == this)
             {
                 p_176475_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 3);
-
-                if (!flag)
-                {
-                    this.func_176226_b(p_176475_1_, blockpos2, p_176475_3_, 0);
-                }
             }
         }
     }
 
     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) return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); //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.
         if (p_180671_3_.func_177229_b(field_176492_b) == BlockDoublePlant.EnumBlockHalf.UPPER)
         {
             return p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c() == this;
@@ -157,7 +155,6 @@
 
     public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_)
     {
-        if (p_180657_1_.field_72995_K || p_180657_2_.func_71045_bC() == null || p_180657_2_.func_71045_bC().func_77973_b() != Items.field_151097_aZ || p_180657_4_.func_177229_b(field_176492_b) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.func_176489_b(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_))
         {
             super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_);
         }
@@ -296,6 +293,23 @@
         return Block.EnumOffsetType.XZ;
     }
 
+    @Override
+    public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos)
+    {
+        IBlockState state = world.func_180495_p(pos);
+        EnumPlantType type = (EnumPlantType)state.func_177229_b(field_176493_a);
+        return state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS);
+    }
+    @Override
+    public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+    {
+        java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+        EnumPlantType type = (EnumPlantType)world.func_180495_p(pos).func_177229_b(field_176493_a);
+        if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.FERN.func_177044_a()));
+        if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.GRASS.func_177044_a()));
+        return ret;
+    }
+
     static enum EnumBlockHalf implements IStringSerializable
     {
         UPPER,<commit_msg>Fixed vanilla bug where top part of double plants would flicker a tifferent texture before dissapearing.<commit_after>--- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java
@@ -24,7 +24,7 @@
 import net.minecraftforge.fml.relauncher.Side;
 import net.minecraftforge.fml.relauncher.SideOnly;
 
-public class BlockDoublePlant extends BlockBush implements IGrowable
+public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable
 {
     public static final PropertyEnum field_176493_a = PropertyEnum.func_177709_a("variant", BlockDoublePlant.EnumPlantType.class);
     public static final PropertyEnum field_176492_b = PropertyEnum.func_177709_a("half", BlockDoublePlant.EnumBlockHalf.class);
@@ -89,6 +89,8 @@
             Object object = flag ? this : p_176475_1_.func_180495_p(blockpos1).func_177230_c();
             Object object1 = flag ? p_176475_1_.func_180495_p(blockpos2).func_177230_c() : this;
 
+            if (!flag) this.func_176226_b(p_176475_1_, p_176475_2_, p_176475_3_, 0); //Forge move above the setting to air.
+
             if (object == this)
             {
                 p_176475_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3);
@@ -97,17 +99,13 @@
             if (object1 == this)
             {
                 p_176475_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 3);
-
-                if (!flag)
-                {
-                    this.func_176226_b(p_176475_1_, blockpos2, p_176475_3_, 0);
-                }
             }
         }
     }
 
     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) return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); //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.
         if (p_180671_3_.func_177229_b(field_176492_b) == BlockDoublePlant.EnumBlockHalf.UPPER)
         {
             return p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c() == this;
@@ -157,7 +155,6 @@
 
     public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_)
     {
-        if (p_180657_1_.field_72995_K || p_180657_2_.func_71045_bC() == null || p_180657_2_.func_71045_bC().func_77973_b() != Items.field_151097_aZ || p_180657_4_.func_177229_b(field_176492_b) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.func_176489_b(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_))
         {
             super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_);
         }
@@ -296,6 +293,32 @@
         return Block.EnumOffsetType.XZ;
     }
 
+    @Override
+    public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos)
+    {
+        IBlockState state = world.func_180495_p(pos);
+        EnumPlantType type = (EnumPlantType)state.func_177229_b(field_176493_a);
+        return state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS);
+    }
+    @Override
+    public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+    {
+        java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+        EnumPlantType type = (EnumPlantType)world.func_180495_p(pos).func_177229_b(field_176493_a);
+        if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.FERN.func_177044_a()));
+        if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.GRASS.func_177044_a()));
+        return ret;
+    }
+    @Override
+    public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
+    {
+        //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames.
+        IBlockState state = world.func_180495_p(pos);
+        if (state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && world.func_180495_p(pos.func_177984_a()).func_177230_c() == this)
+            world.func_175698_g(pos.func_177984_a());
+        return world.func_175698_g(pos);
+    }
+
     static enum EnumBlockHalf implements IStringSerializable
     {
         UPPER,
{'fraction_non_alphanumeric': 0.10963259538389072, 'fraction_numerical': 0.14319359397079603, 'mean_word_length': 3.4817941952506595, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7249612', 'n_tokens_mistral': 3822, 'n_tokens_neox': 3111, 'n_words': 510}