summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/BlockMonsterEggs.java
blob: d9f874151b516b02ca5b0f7cb8d48c907b33dcb6 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package net.minecraft.server;

import java.util.Random;

import net.minecraft.util.org.apache.commons.lang3.tuple.ImmutablePair;

import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; // CraftBukkit

public class BlockMonsterEggs extends Block {

    public static final String[] a = new String[] { "stone", "cobble", "brick", "mossybrick", "crackedbrick", "chiseledbrick"};

    public BlockMonsterEggs() {
        super(Material.CLAY);
        this.c(0.0F);
        this.a(CreativeModeTab.c);
    }

    public void postBreak(World world, int i, int j, int k, int l) {
        if (!world.isStatic) {
            EntitySilverfish entitysilverfish = new EntitySilverfish(world);

            entitysilverfish.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, 0.0F, 0.0F);
            world.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
            entitysilverfish.s();
        }

        super.postBreak(world, i, j, k, l);
    }

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

    public static boolean a(Block block) {
        return block == Blocks.STONE || block == Blocks.COBBLESTONE || block == Blocks.SMOOTH_BRICK;
    }

    public static int a(Block block, int i) {
        if (i == 0) {
            if (block == Blocks.COBBLESTONE) {
                return 1;
            }

            if (block == Blocks.SMOOTH_BRICK) {
                return 2;
            }
        } else if (block == Blocks.SMOOTH_BRICK) {
            switch (i) {
                case 1:
                    return 3;

                case 2:
                    return 4;

                case 3:
                    return 5;
            }
        }

        return 0;
    }

    public static ImmutablePair b(int i) {
        switch (i) {
            case 1:
                return new ImmutablePair(Blocks.COBBLESTONE, Integer.valueOf(0));

            case 2:
                return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(0));

            case 3:
                return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(1));

            case 4:
                return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(2));

            case 5:
                return new ImmutablePair(Blocks.SMOOTH_BRICK, Integer.valueOf(3));

            default:
                return new ImmutablePair(Blocks.STONE, Integer.valueOf(0));
        }
    }

    protected ItemStack j(int i) {
        switch (i) {
            case 1:
                return new ItemStack(Blocks.COBBLESTONE);

            case 2:
                return new ItemStack(Blocks.SMOOTH_BRICK);

            case 3:
                return new ItemStack(Blocks.SMOOTH_BRICK, 1, 1);

            case 4:
                return new ItemStack(Blocks.SMOOTH_BRICK, 1, 2);

            case 5:
                return new ItemStack(Blocks.SMOOTH_BRICK, 1, 3);

            default:
                return new ItemStack(Blocks.STONE);
        }
    }

    public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
        if (!world.isStatic) {
            EntitySilverfish entitysilverfish = new EntitySilverfish(world);

            entitysilverfish.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, 0.0F, 0.0F);
            world.addEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
            entitysilverfish.s();
        }
    }

    public int getDropData(World world, int i, int j, int k) {
        return world.getData(i, j, k);
    }
}