diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java b/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java index fbb32342b..5fb74285c 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPLeaves.java @@ -8,15 +8,11 @@ package biomesoplenty.common.block; -import java.util.List; -import java.util.Random; - -import com.google.common.collect.Lists; - import biomesoplenty.api.enums.BOPTrees; import biomesoplenty.api.item.BOPItems; import biomesoplenty.common.item.ItemBOPBlock; import biomesoplenty.common.util.block.VariantPagingHelper; +import com.google.common.collect.Lists; import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockPlanks; import net.minecraft.block.properties.IProperty; @@ -31,6 +27,8 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -42,6 +40,10 @@ import net.minecraft.world.biome.BiomeColorHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; +import java.util.List; +import java.util.Random; + // TODO: using fast graphics - transparent color is always rendered as black - can we override this somehow? // TODO: using fast graphics - flowering leaves overlay seems to be tinted green - I think that is because it doesn't use distinct tintindexes on fast graphics // In older versions a completely different single texture could be used for fast graphics, but I'm not sure that's an option any more @@ -224,7 +226,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock } @Override - public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { BOPTrees treeType = ((BOPTrees) state.getValue(this.variantProperty)); @@ -357,10 +359,22 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock spawnAsEntity(worldIn, pos, fruit); } } - @Override - public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack) + { + if (!worldIn.isRemote && stack != null && stack.getItem() == Items.SHEARS) + { + player.addStat(StatList.getBlockStats(this)); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te, stack); + } + } + + @Override + public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { List ret = new java.util.ArrayList(); IBlockState state = world.getBlockState(pos);