Fixed that shearing of BoP leaves still dropped fruits & saplings

This commit is contained in:
GirafiStudios 2016-09-10 02:33:40 +02:00
parent d98ec78ccd
commit 526f80d6e2

View file

@ -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<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
BOPTrees treeType = ((BOPTrees) state.getValue(this.variantProperty));
@ -358,9 +360,21 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
}
}
@Override
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<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
{
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
IBlockState state = world.getBlockState(pos);