geforkt von Mirrors/Paper
Add inverted flag support to TrapDoor. Fixes BUKKIT-3390
By: Peter Olson <peter.olson@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
b965616431
Commit
4d1f2668bf
@ -43,6 +43,26 @@ public class TrapDoor extends SimpleAttachableMaterialData implements Openable {
|
||||
setData(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if trapdoor is inverted
|
||||
* @return true if inverted (top half), false if normal (bottom half)
|
||||
*/
|
||||
public boolean isInverted() {
|
||||
return ((getData() & 0x8) != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set trapdoor inverted state
|
||||
* @param inv - true if inverted (top half), false if normal (bottom half)
|
||||
*/
|
||||
public void setInverted(boolean inv) {
|
||||
int dat = getData() & 0x7;
|
||||
if (inv) {
|
||||
dat |= 0x8;
|
||||
}
|
||||
setData((byte) dat);
|
||||
}
|
||||
|
||||
public BlockFace getAttachedFace() {
|
||||
byte data = (byte) (getData() & 0x3);
|
||||
|
||||
@ -65,7 +85,7 @@ public class TrapDoor extends SimpleAttachableMaterialData implements Openable {
|
||||
}
|
||||
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
byte data = (byte) (getData() & 0x4);
|
||||
byte data = (byte) (getData() & 0xC);
|
||||
|
||||
switch (face) {
|
||||
case SOUTH:
|
||||
@ -84,11 +104,11 @@ public class TrapDoor extends SimpleAttachableMaterialData implements Openable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (isOpen() ? "OPEN " : "CLOSED ") + super.toString() + " with hinges set " + getAttachedFace();
|
||||
return (isOpen() ? "OPEN " : "CLOSED ") + super.toString() + " with hinges set " + getAttachedFace() + (isInverted() ? " inverted" : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrapDoor clone() {
|
||||
return (TrapDoor) super.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren