Added support for rotation block orientation with the rotate and flip commands.

This commit is contained in:
sk89q
2011-01-29 23:10:12 -08:00
parent 4455c9dcd9
commit 52cb2e0997
3 changed files with 271 additions and 1 deletions

View File

@@ -19,6 +19,8 @@
package com.sk89q.worldedit.blocks;
import com.sk89q.worldedit.data.BlockData;
/**
* Represents a block.
*
@@ -89,4 +91,25 @@ public class BaseBlock {
public boolean isAir() {
return type == 0;
}
/**
* Rotate this block 90 degrees.
*/
public void rotate90() {
data = (char)BlockData.rotate90(type, data);
}
/**
* Rotate this block -90 degrees.
*/
public void rotate90Reverse() {
data = (char)BlockData.rotate90Reverse(type, data);
}
/**
* Flip this block.
*/
public void flip() {
data = (char)BlockData.flip(type, data);
}
}