summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/ItemMobSpawner.java
blob: e0c0e8053c4cf6cd7c0d1c17cc4ace5653cf18cd (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
package net.minecraft.server;

public class ItemMobSpawner extends ItemLog {

    public  ItemMobSpawner(int i) {
        super(i, Block.MOB_SPAWNER);
    }
    
    public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
        if(!super.a(itemstack, entityhuman, world, i, j, k, l)) return false;
        System.out.println("Placed the spawner, checking it's entity");
        if (l == 0) {
            --j;
        }

        if (l == 1) {
            ++j;
        }

        if (l == 2) {
            --k;
        }

        if (l == 3) {
            ++k;
        }

        if (l == 4) {
            --i;
        }

        if (l == 5) {
            ++i;
        }
        TileEntity entity = world.getTileEntity(i, j, k);
        System.out.println(entity);
        if (entity instanceof TileEntityMobSpawner) {
            System.out.println("Got a valid spawner, attempt to set its type");
            ((TileEntityMobSpawner)entity).setId(itemstack.getData());
            return true;
        }
        else return false;
    }
}