forked from CloudburstMC/Nukkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockOreRedstoneGlowing.java
More file actions
48 lines (39 loc) · 1.13 KB
/
BlockOreRedstoneGlowing.java
File metadata and controls
48 lines (39 loc) · 1.13 KB
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
package cn.nukkit.block;
import cn.nukkit.event.block.BlockFadeEvent;
import cn.nukkit.item.Item;
import cn.nukkit.item.ItemBlock;
import cn.nukkit.level.Level;
/**
* Created on 2015/12/6 by xtypr.
* Package cn.nukkit.block in project Nukkit .
*/
public class BlockOreRedstoneGlowing extends BlockOreRedstone {
@Override
public String getName() {
return "Glowing Redstone Ore";
}
@Override
public int getId() {
return GLOWING_REDSTONE_ORE;
}
@Override
public int getLightLevel() {
return 9;
}
@Override
public Item toItem() {
return new ItemBlock(Block.get(REDSTONE_ORE));
}
@Override
public int onUpdate(int type) {
if (type == Level.BLOCK_UPDATE_SCHEDULED || type == Level.BLOCK_UPDATE_RANDOM) {
BlockFadeEvent event = new BlockFadeEvent(this, get(REDSTONE_ORE));
level.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
level.setBlock(this, event.getNewState(), false, true);
}
return Level.BLOCK_UPDATE_WEAK;
}
return 0;
}
}