summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/BlockIce.java
blob: b7215376f07d03b1dfdb9fd835c141b8715f1df3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package net.minecraft.server;

import java.util.Random;

public class BlockIce extends BlockHalfTransparant {

    public BlockIce(int i, int j) {
        super(i, j, Material.ICE, false);
        this.frictionFactor = 0.98F;
        this.b(true);
        this.a(CreativeModeTab.b);
    }

    public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
        entityhuman.a(StatisticList.C[this.id], 1);
        entityhuman.j(0.025F);
        if (this.s_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
            ItemStack itemstack = this.f_(l);

            if (itemstack != null) {
                this.b(world, i, j, k, itemstack);
            }
        } else {
            if (world.worldProvider.e) {
                world.setTypeId(i, j, k, 0);
                return;
            }

            int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman);

            this.c(world, i, j, k, l, i1);
            Material material = world.getMaterial(i, j - 1, k);

            if (material.isSolid() || material.isLiquid()) {
                world.setTypeId(i, j, k, Block.WATER.id);
            }
        }
    }

    public int a(Random random) {
        return 0;
    }

    public void b(World world, int i, int j, int k, Random random) {
        if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.lightBlock[this.id]) {
            // CraftBukkit start
            if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Block.STATIONARY_WATER.id).isCancelled()) {
                return;
            }
            // CraftBukkit end

            if (world.worldProvider.e) {
                world.setTypeId(i, j, k, 0);
                return;
            }

            this.c(world, i, j, k, world.getData(i, j, k), 0);
            world.setTypeId(i, j, k, Block.STATIONARY_WATER.id);
        }
    }

    public int q_() {
        return 0;
    }
}