forked from CloudburstMC/Nukkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockRedstoneRepeaterPowered.java
More file actions
79 lines (63 loc) · 1.59 KB
/
BlockRedstoneRepeaterPowered.java
File metadata and controls
79 lines (63 loc) · 1.59 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
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
package cn.nukkit.block;
import cn.nukkit.Player;
import cn.nukkit.item.Item;
import cn.nukkit.math.BlockFace;
/**
* Created by CreeperFace on 10.4.2017.
*/
public class BlockRedstoneRepeaterPowered extends BlockRedstoneDiode {
public BlockRedstoneRepeaterPowered() {
this(0);
}
public BlockRedstoneRepeaterPowered(int meta) {
super(meta);
this.isPowered = true;
}
@Override
public int getId() {
return POWERED_REPEATER;
}
@Override
public String getName() {
return "Powered Repeater";
}
@Override
public BlockFace getFacing() {
return BlockFace.fromHorizontalIndex(getDamage());
}
@Override
protected boolean isAlternateInput(Block block) {
return isDiode(block);
}
@Override
public Item toItem() {
return Item.get(Item.REPEATER);
}
@Override
protected int getDelay() {
return (1 + (getDamage() >> 2)) << 1;
}
@Override
protected Block getPowered() {
return this;
}
@Override
protected Block getUnpowered() {
return Block.get(UNPOWERED_REPEATER, this.getDamage());
}
@Override
public int getLightLevel() {
return 7;
}
@Override
public boolean onActivate(Item item, Player player) {
this.setDamage(this.getDamage() + 4);
if (this.getDamage() > 15) this.setDamage(this.getDamage() % 4);
this.level.setBlock(this, this, true, true);
return true;
}
@Override
public boolean isLocked() {
return this.getPowerOnSides() > 0;
}
}