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);
|
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() {
|
public BlockFace getAttachedFace() {
|
||||||
byte data = (byte) (getData() & 0x3);
|
byte data = (byte) (getData() & 0x3);
|
||||||
|
|
||||||
@ -65,7 +85,7 @@ public class TrapDoor extends SimpleAttachableMaterialData implements Openable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setFacingDirection(BlockFace face) {
|
public void setFacingDirection(BlockFace face) {
|
||||||
byte data = (byte) (getData() & 0x4);
|
byte data = (byte) (getData() & 0xC);
|
||||||
|
|
||||||
switch (face) {
|
switch (face) {
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
@ -84,7 +104,7 @@ public class TrapDoor extends SimpleAttachableMaterialData implements Openable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
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
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren