MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / harvestBlock

Method harvestBlock

src/main/java/net/minecraft/block/Block.java:1009–1028  ·  view source on GitHub ↗
(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)

Source from the content-addressed store, hash-verified

1007 }
1008
1009 public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
1010 {
1011 player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]);
1012 player.addExhaustion(0.025F);
1013
1014 if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player))
1015 {
1016 ItemStack itemstack = this.createStackedBlock(state);
1017
1018 if (itemstack != null)
1019 {
1020 spawnAsEntity(worldIn, pos, itemstack);
1021 }
1022 }
1023 else
1024 {
1025 int i = EnchantmentHelper.getFortuneModifier(player);
1026 this.dropBlockAsItem(worldIn, pos, state, i);
1027 }
1028 }
1029
1030 protected boolean canSilkHarvest()
1031 {

Callers 1

tryHarvestBlockMethod · 0.45

Calls 9

getIdFromBlockMethod · 0.95
canSilkHarvestMethod · 0.95
getSilkTouchModifierMethod · 0.95
createStackedBlockMethod · 0.95
spawnAsEntityMethod · 0.95
getFortuneModifierMethod · 0.95
dropBlockAsItemMethod · 0.95
triggerAchievementMethod · 0.80
addExhaustionMethod · 0.45

Tested by

no test coverage detected