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

import java.util.Random;

public class BlockDaylightDetector extends BlockContainer {

    private IIcon[] a = new IIcon[2];

    public BlockDaylightDetector(int i) {
        super(i, Material.WOOD);
        this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.375F, 1.0F);
        this.a(CreativeModeTab.d);
    }

    public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
        this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.375F, 1.0F);
    }

    public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
        return iblockaccess.getData(i, j, k);
    }

    public void a(World world, int i, int j, int k, Random random) {}

    public void doPhysics(World world, int i, int j, int k, int l) {}

    public void onPlace(World world, int i, int j, int k) {}

    public void i_(World world, int i, int j, int k) {
        if (!world.worldProvider.g) {
            int l = world.getData(i, j, k);
            int i1 = world.b(EnumSkyBlock.SKY, i, j, k) - world.j;
            float f = world.d(1.0F);

            if (f < 3.1415927F) {
                f += (0.0F - f) * 0.2F;
            } else {
                f += (6.2831855F - f) * 0.2F;
            }

            i1 = Math.round((float) i1 * MathHelper.cos(f));
            if (i1 < 0) {
                i1 = 0;
            }

            if (i1 > 15) {
                i1 = 15;
            }

            if (l != i1) {
                i1 = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, i, j, k, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
                world.setData(i, j, k, i1, 3);
            }
        }
    }

    public boolean b() {
        return false;
    }

    public boolean c() {
        return false;
    }

    public boolean isPowerSource() {
        return true;
    }

    public TileEntity b(World world) {
        return new TileEntityLightDetector();
    }
}