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

Method harvestBlock

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

Source from the content-addressed store, hash-verified

31 }
32
33 public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
34 {
35 player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
36 player.addExhaustion(0.025F);
37
38 if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player))
39 {
40 ItemStack itemstack = this.createStackedBlock(state);
41
42 if (itemstack != null)
43 {
44 spawnAsEntity(worldIn, pos, itemstack);
45 }
46 }
47 else
48 {
49 if (worldIn.provider.doesWaterVaporize())
50 {
51 worldIn.setBlockToAir(pos);
52 return;
53 }
54
55 int i = EnchantmentHelper.getFortuneModifier(player);
56 this.dropBlockAsItem(worldIn, pos, state, i);
57 Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial();
58
59 if (material.blocksMovement() || material.isLiquid())
60 {
61 worldIn.setBlockState(pos, Blocks.flowing_water.getDefaultState());
62 }
63 }
64 }
65
66 /**
67 * Returns the quantity of items to drop on block destruction.

Callers

nothing calls this directly

Calls 15

getIdFromBlockMethod · 0.95
getSilkTouchModifierMethod · 0.95
getFortuneModifierMethod · 0.95
blocksMovementMethod · 0.95
isLiquidMethod · 0.95
triggerAchievementMethod · 0.80
spawnAsEntityMethod · 0.80
doesWaterVaporizeMethod · 0.80
setBlockToAirMethod · 0.80
dropBlockAsItemMethod · 0.80
downMethod · 0.80
getDefaultStateMethod · 0.80

Tested by

no test coverage detected