BlockIce .java

net.minecraft.block.BlockIce (class): members: getMobilityFlag, harvestBlock, quantityDropped, getBlockLayer, updateTick. imports: EnumSkyBlock, StatList.

net.minecraft.blockclass95 linescommonextends BlockBreakable2.8 KB

API Surface (5)

EnumWorldBlockLayer getBlockLayer()
void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
int quantityDropped(Random random)
void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
int getMobilityFlag()

Full Source

BlockIce.java95 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import java.util.Random;
4
import net.minecraft.block.material.Material;
5
import net.minecraft.block.state.IBlockState;
6
import net.minecraft.creativetab.CreativeTabs;
7
import net.minecraft.enchantment.EnchantmentHelper;
8
import net.minecraft.entity.player.EntityPlayer;
9
import net.minecraft.init.Blocks;
10
import net.minecraft.item.ItemStack;
11
import net.minecraft.stats.StatList;
12
import net.minecraft.tileentity.TileEntity;
13
import net.minecraft.util.BlockPos;
14
import net.minecraft.util.EnumWorldBlockLayer;
15
import net.minecraft.world.EnumSkyBlock;
16
import net.minecraft.world.World;
17
18
public class BlockIce extends BlockBreakable
19
{
20
    public BlockIce()
21
    {
22
        super(Material.ice, false);
23
        this.slipperiness = 0.98F;
24
        this.setTickRandomly(true);
25
        this.setCreativeTab(CreativeTabs.tabBlock);
26
    }
27
28
    public EnumWorldBlockLayer getBlockLayer()
29
    {
30
        return EnumWorldBlockLayer.TRANSLUCENT;
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.
68
     */
69
    public int quantityDropped(Random random)
70
    {
71
        return 0;
72
    }
73
74
    public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
75
    {
76
        if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11 - this.getLightOpacity())
77
        {
78
            if (worldIn.provider.doesWaterVaporize())
79
            {
80
                worldIn.setBlockToAir(pos);
81
            }
82
            else
83
            {
84
                this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
85
                worldIn.setBlockState(pos, Blocks.water.getDefaultState());
86
            }
87
        }
88
    }
89
90
    public int getMobilityFlag()
91
    {
92
        return 0;
93
    }
94
}
95

Deobfuscated MCP 1.8.9 source of BlockIce from Marcelektro/MavenMCP-1.8.9 (net/minecraft/block/BlockIce.java), stored verbatim.