本文整理汇总了Java中org.bukkit.block.BlockFace.EAST属性的典型用法代码示例。如果您正苦于以下问题:Java BlockFace.EAST属性的具体用法?Java BlockFace.EAST怎么用?Java BlockFace.EAST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.block.BlockFace
的用法示例。
在下文中一共展示了BlockFace.EAST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notchToBlockFace
/**
* Notch uses a 0-5 to mean DOWN, UP, NORTH, SOUTH, WEST, EAST
* in that order all over. This method is convenience to convert for us.
*
* @return BlockFace the BlockFace represented by this number
*/
public static BlockFace notchToBlockFace(int notch) {
switch (notch) {
case 0:
return BlockFace.DOWN;
case 1:
return BlockFace.UP;
case 2:
return BlockFace.NORTH;
case 3:
return BlockFace.SOUTH;
case 4:
return BlockFace.WEST;
case 5:
return BlockFace.EAST;
default:
return BlockFace.SELF;
}
}
示例2: send
@Override
public void send(Player p) {
if (direction == BlockFace.UP || direction == BlockFace.DOWN) {
new CircleForm(getLocation(), "y", getDense(), getRadius(), getAction()).send(p);
new CircleForm(getLocation().clone().add(0, getDepth(), 0), "y", getDense(), getRadius(), getAction()).send(p);
for (double d = getDense(); d < getDepth() - getDense(); d += getDense())
new CircleForm(getLocation().clone().add(0, d, 0), "y", getDense(), getRadius(), getAction()).send(p);
} else if (direction == BlockFace.EAST || direction == BlockFace.WEST) {
new CircleForm(getLocation(), "z", getDense(), getRadius(), getAction()).send(p);
new CircleForm(getLocation().clone().add(getDepth(), 0, 0), "z", getDense(), getRadius(), getAction()).send(p);
for (double d = getDense(); d < getDepth() - getDense(); d += getDense())
new CircleForm(getLocation().clone().add(d, 0, 0), "z", getDense(), getRadius(), getAction()).send(p);
} else {
new CircleForm(getLocation(), "x", getDense(), getRadius(), getAction()).send(p);
new CircleForm(getLocation().clone().add(0, 0, getDepth()), "x", getDense(), getRadius(), getAction()).send(p);
for (double d = getDense(); d < getDepth() - getDense(); d += getDense())
new CircleForm(getLocation().clone().add(0, 0, d), "x", getDense(), getRadius(), getAction()).send(p);
}
}
示例3: send
@Override
public void send(Player p) {
if (direction == BlockFace.UP) {
for (double r = basis; r > 0 && size != 0; r -= getDense(), size -= getDense())
new RectangleForm(getLocation().clone().subtract(0, r, 0), "y", getDense(), r, r, isFilled(), getAction()).send(p);
} else if (direction == BlockFace.EAST) {
for (double r = basis; r > 0 && size != 0; r -= getDense(), size -= getDense())
new RectangleForm(getLocation().clone().subtract(r, 0, 0), "z", getDense(), r, r, isFilled(), getAction()).send(p);
} else if (direction == BlockFace.WEST) {
for (double r = basis; r > 0 && size != 0; r -= getDense(), size -= getDense())
new RectangleForm(getLocation().clone().add(r, 0, 0), "z", getDense(), r, r, isFilled(), getAction()).send(p);
} else if (direction == BlockFace.SOUTH) {
for (double r = basis; r > 0 && size != 0; r -= getDense(), size -= getDense())
new RectangleForm(getLocation().clone().subtract(0, 0, r), "x", getDense(), r, r, isFilled(), getAction()).send(p);
} else if (direction == BlockFace.NORTH) {
for (double r = basis; r > 0 && size != 0; r -= getDense(), size -= getDense())
new RectangleForm(getLocation().clone().add(0, 0, r), "x", getDense(), r, r, isFilled(), getAction()).send(p);
} else {
for (double r = basis; r > 0 && size != 0; r -= getDense(), size -= getDense())
new RectangleForm(getLocation().clone().add(0, r, 0), "y", getDense(), r, r, isFilled(), getAction()).send(p);
}
}
示例4: send
@Override
public void send(Player p) {
if (direction == BlockFace.UP) {
for (double r = baseRadius; r > 0 && size != 0; r -= getDense(), size -= getDense())
new CircleForm(getLocation().clone().subtract(0, r, 0), "y", getDense(), r, getAction()).send(p);
} else if (direction == BlockFace.EAST) {
for (double r = baseRadius; r > 0 && size != 0; r -= getDense(), size -= getDense())
new CircleForm(getLocation().clone().subtract(r, 0, 0), "z", getDense(), r, getAction()).send(p);
} else if (direction == BlockFace.WEST) {
for (double r = baseRadius; r > 0 && size != 0; r -= getDense(), size -= getDense())
new CircleForm(getLocation().clone().add(r, 0, 0), "z", getDense(), r, getAction()).send(p);
} else if (direction == BlockFace.SOUTH) {
for (double r = baseRadius; r > 0 && size != 0; r -= getDense(), size -= getDense())
new CircleForm(getLocation().clone().subtract(0, 0, r), "x", getDense(), r, getAction()).send(p);
} else if (direction == BlockFace.NORTH) {
for (double r = baseRadius; r > 0 && size != 0; r -= getDense(), size -= getDense())
new CircleForm(getLocation().clone().add(0, 0, r), "x", getDense(), r, getAction()).send(p);
} else {
for (double r = baseRadius; r > 0 && size != 0; r -= getDense(), size -= getDense())
new CircleForm(getLocation().clone().add(0, r, 0), "y", getDense(), r, getAction()).send(p);
}
}
示例5: getFacing
public BlockFace getFacing() {
switch (this.getHandle().hangingDirection) {
case 0:
default:
return BlockFace.SOUTH;
case 1:
return BlockFace.WEST;
case 2:
return BlockFace.NORTH;
case 3:
return BlockFace.EAST;
}
}
示例6: getBlockPower
public int getBlockPower(BlockFace face) {
int power = 0;
BlockRedstoneWire wire = Blocks.redstone_wire;
net.minecraft.world.World world = chunk.getHandle().worldObj;
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y - 1, z, 0)) power = wire.func_150178_a(world, x, y - 1, z, power);
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y + 1, z, 1)) power = wire.func_150178_a(world, x, y + 1, z, power);
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x + 1, y, z, 2)) power = wire.func_150178_a(world, x + 1, y, z, power);
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.getIndirectPowerOutput(x - 1, y, z, 3)) power = wire.func_150178_a(world, x - 1, y, z, power);
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z - 1, 4)) power = wire.func_150178_a(world, x, y, z - 1, power);
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.getIndirectPowerOutput(x, y, z + 1, 5)) power = wire.func_150178_a(world, x, y, z - 1, power);
return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
}
示例7: getBlockFace
static BlockFace getBlockFace(byte rotation) {
switch (rotation) {
case 0:
return BlockFace.NORTH;
case 1:
return BlockFace.NORTH_NORTH_EAST;
case 2:
return BlockFace.NORTH_EAST;
case 3:
return BlockFace.EAST_NORTH_EAST;
case 4:
return BlockFace.EAST;
case 5:
return BlockFace.EAST_SOUTH_EAST;
case 6:
return BlockFace.SOUTH_EAST;
case 7:
return BlockFace.SOUTH_SOUTH_EAST;
case 8:
return BlockFace.SOUTH;
case 9:
return BlockFace.SOUTH_SOUTH_WEST;
case 10:
return BlockFace.SOUTH_WEST;
case 11:
return BlockFace.WEST_SOUTH_WEST;
case 12:
return BlockFace.WEST;
case 13:
return BlockFace.WEST_NORTH_WEST;
case 14:
return BlockFace.NORTH_WEST;
case 15:
return BlockFace.NORTH_NORTH_WEST;
default:
throw new AssertionError(rotation);
}
}
示例8: fireShell
public void fireShell(Vector look, Player p)
{
tntp.setVelocity(look);
if( cannonType == 1 )
{
tntp2.setVelocity(look);
}
if( cannonType == 6 )
{
tntp2.setVelocity(look);
tntp3.setVelocity(look);
}
charged = 0;
Block b;
b = loc.getBlock().getRelative(BlockFace.UP);
b.getWorld().createExplosion(loc.getBlock().getRelative(direction,4).getLocation(), 0);
if( cannonType == 6 )
{
if( direction == BlockFace.EAST || direction == BlockFace.WEST )
{
b.getWorld().createExplosion(loc.getBlock().getRelative(direction,4).getRelative(BlockFace.NORTH,2).getLocation(), 0);
b.getWorld().createExplosion(loc.getBlock().getRelative(direction,4).getRelative(BlockFace.SOUTH,2).getLocation(), 0);
}else
{
b.getWorld().createExplosion(loc.getBlock().getRelative(direction,4).getRelative(BlockFace.EAST,2).getLocation(), 0);
b.getWorld().createExplosion(loc.getBlock().getRelative(direction,4).getRelative(BlockFace.WEST,2).getLocation(), 0);
}
}
}
示例9: getDirectionFromRelative
public Block getDirectionFromRelative(Block blockIn, BlockFace dir, boolean left)
{
Block b;
if( dir == BlockFace.NORTH )
{
if( left )
b = blockIn.getRelative(BlockFace.WEST);
else
b = blockIn.getRelative(BlockFace.EAST);
}else if( dir == BlockFace.SOUTH )
{
if( left )
b = blockIn.getRelative(BlockFace.EAST);
else
b = blockIn.getRelative(BlockFace.WEST);
}else if( dir == BlockFace.EAST )
{
if( left )
b = blockIn.getRelative(BlockFace.NORTH);
else
b = blockIn.getRelative(BlockFace.SOUTH);
}else //if( direction == BlockFace.WEST )
{
if( left )
b = blockIn.getRelative(BlockFace.SOUTH);
else
b = blockIn.getRelative(BlockFace.NORTH);
}
return b;
}
示例10: getTubeBlockFace
public BlockFace getTubeBlockFace(boolean left)
{
BlockFace bf;
if( direction == BlockFace.NORTH )
{
if( left )
bf = BlockFace.WEST;
else
bf = BlockFace.EAST;
}else if( direction == BlockFace.SOUTH )
{
if( left )
bf = BlockFace.EAST;
else
bf = BlockFace.WEST;
}else if( direction == BlockFace.EAST )
{
if( left )
bf = BlockFace.NORTH;
else
bf = BlockFace.SOUTH;
}else //if( direction == BlockFace.WEST )
{
if( left )
bf = BlockFace.SOUTH;
else
bf = BlockFace.NORTH;
}
return bf;
}
示例11: isGeckBuildCorrect
/**
* Checks if the geck structure is correct.
*
* @param center
* The center block.
* @return true if the build is correct, false otherwise.
*/
public boolean isGeckBuildCorrect(Block center) {
BlockFace[] faces = { BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH };
for (BlockFace f : faces) {
if (center.getRelative(f).getType() != Material.PISTON_BASE)
return false;
}
return true;
}
示例12: getBlockFace
public static BlockFace getBlockFace(double yaw){
int y = (int) ((yaw+11.25)/22.5);
switch(y){
case -8:
return BlockFace.NORTH;
case -7:
return BlockFace.NORTH_NORTH_EAST;
case -6:
return BlockFace.NORTH_EAST;
case -5:
return BlockFace.EAST_NORTH_EAST;
case -4:
return BlockFace.EAST;
case -3:
return BlockFace.EAST_SOUTH_EAST;
case -2:
return BlockFace.SOUTH_EAST;
case -1:
return BlockFace.SOUTH_SOUTH_EAST;
case 0:
return BlockFace.SOUTH;
case 1:
return BlockFace.SOUTH_SOUTH_WEST;
case 2:
return BlockFace.SOUTH_WEST;
case 3:
return BlockFace.WEST_SOUTH_WEST;
case 4:
return BlockFace.WEST;
case 5:
return BlockFace.WEST_NORTH_WEST;
case 6:
return BlockFace.NORTH_WEST;
case 7:
return BlockFace.NORTH_NORTH_WEST;
default:
return BlockFace.NORTH;
}
}
示例13: addChunk
private void addChunk(Player player, Region region, String[] args, int i) {
World world = player.getWorld();
Chunk chunk = player.getLocation().getChunk();
int x = chunk.getX();
int z = chunk.getZ();
boolean override = args.length > i + 2 ? args[i + 2].equalsIgnoreCase("-override") : false;
if (region == null) {
ParsingUtil.sendMessage(player, ChatColor.RED + "/f world addChunk [region name] [radius|line|auto] [value] ([-override])");
return;
}
if (args.length >= i + 1) {
if (args[i].equalsIgnoreCase("radius") || args[i].equalsIgnoreCase("r")) {
int r = args.length > i + 1 ? NumberUtil.parseInt(args[i + 1]) : 1;
x += -1 * r;
z += -1 * r;
while (z <= chunk.getZ() + r) {
if (board.isWilderness(world.getChunkAt(x, z)) || override) {
addChunk(region, world.getChunkAt(x, z), override);
}
x++;
if (x > chunk.getX() + r) {
x = chunk.getX() + -1 * r;
z++;
}
}
} else if (args[i].equalsIgnoreCase("line") || args[i].equalsIgnoreCase("l")) {
int l = args.length > i + 1 ? NumberUtil.parseInt(args[i + 1]) : 1;
BlockFace face = AXIS[Math.round(player.getLocation().getYaw() / 90F) & 0x3];
if (face == BlockFace.NORTH) {
while (l >= 0) {
if (board.isWilderness(world.getChunkAt(x, z + l)) || override) {
addChunk(region, world.getChunkAt(x, z + l), override);
}
l--;
}
} else if (face == BlockFace.EAST) {
while (l >= 0) {
if (board.isWilderness(world.getChunkAt(x - l, z)) || override) {
addChunk(region, world.getChunkAt(x - l, z), override);
}
l--;
}
} else if (face == BlockFace.WEST) {
while (l >= 0) {
if (board.isWilderness(world.getChunkAt(x + l, z)) || override) {
addChunk(region, world.getChunkAt(x + l, z), override);
}
l--;
}
} else if (face == BlockFace.SOUTH) {
while (l >= 0) {
if (board.isWilderness(world.getChunkAt(x, z - l)) || override) {
addChunk(region, world.getChunkAt(x, z - l), override);
}
l--;
}
}
} else if (args[i].equalsIgnoreCase("auto") || args[i].equalsIgnoreCase("a")) {
FPlayer fPlayer = plugin.getFPlayerCache().getByPlayer(player);
if (fPlayer.isAutoclaiming()) {
fPlayer.setAutoclaiming(null);
ParsingUtil.sendMessage(player, FMessage.CMD_WORLD_AUTOCLAIM_END.getMessage());
return;
} else {
fPlayer.setAutoclaiming(region);
ParsingUtil.sendMessage(player, FMessage.CMD_WORLD_AUTOCLAIM_START.getMessage(), region);
}
}
} else {
addChunk(region, chunk, override);
}
ParsingUtil.sendMessage(player, FMessage.CMD_WORLD_CHUNK_ADDED.getMessage(), region);
}
示例14: loadTorpedo
@SuppressWarnings("deprecation")
public boolean loadTorpedo(boolean left)
{
Block b;
b = getDirectionFromRelative(loc.getBlock(), direction, left).getRelative(direction, -5);
if( direction == BlockFace.NORTH && left )
b = b.getRelative(BlockFace.WEST);
else if( direction == BlockFace.NORTH && !left )
b = b.getRelative(BlockFace.EAST);
else if( direction == BlockFace.SOUTH && left )
b = b.getRelative(BlockFace.EAST);
else if( direction == BlockFace.SOUTH && !left )
b = b.getRelative(BlockFace.WEST);
else if( direction == BlockFace.EAST && left )
b = b.getRelative(BlockFace.NORTH);
else if( direction == BlockFace.EAST && !left )
b = b.getRelative(BlockFace.SOUTH);
else if( direction == BlockFace.WEST && left )
b = b.getRelative(BlockFace.SOUTH);
else //if( direction == BlockFace.WEST && !left )
b = b.getRelative(BlockFace.NORTH);
for( int i=0; i<4; i++)
{
if( b.getTypeId() == 35 )
if( b.getRelative(direction,-1).getTypeId() == 35 )
if( b.getRelative(direction,-2).getTypeId() == 35 )
if( b.getRelative(direction,-3).getTypeId() == 35 )
{
if( i > 1 )
loadingTorp(left, b, direction, true);
else
loadingTorp(left, b, direction, false);
if( left )
leftLoading = true;
else
rightLoading = true;
Craft testCraft = Craft.getCraft(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
if( testCraft != null )
{
testCraft.waitTorpLoading++;
}
return true;
}
//move back four spaces unless going from 2 to 3, then carriage return it
if( i == 1 )
b = b.getRelative(direction,4).getRelative(BlockFace.DOWN);
else
b = b.getRelative(direction,-4);
}
return false;
}
示例15: clientNewSign
public void clientNewSign(ChannelHandlerContext ctx, int x, int y, int z, int face, String text) {
if (!allowSigns) {
webSocketServerThread.sendLine(ctx.channel(), "T,Writing on signs is not allowed");
// TODO: revert on client
return;
}
BlockFace blockFace;
switch (face) {
case 0: // west
blockFace = BlockFace.WEST;
x -= 1;
break;
case 1: // east
blockFace = BlockFace.EAST;
x += 1;
break;
default:
case 2: // north
blockFace = BlockFace.NORTH;
z -= 1;
break;
case 3: // south
blockFace = BlockFace.SOUTH;
z += 1;
break;
}
org.bukkit.material.Sign signDirection = new org.bukkit.material.Sign();
signDirection.setFacingDirection(blockFace);
Location location = toBukkitLocation(x, y, z);
if (!withinSandboxRange(location)) {
webSocketServerThread.log(Level.FINEST, "client tried to write a sign outside sandbox range");
return;
}
// Create the sign
Block block = location.getWorld().getBlockAt(location);
/*
block.setTypeIdAndData(Material.WALL_SIGN.getId(), data, applyPhysics);
webSocketServerThread.log(Level.FINEST, "setting sign at "+location+" data="+data);
*/
BlockState blockState = block.getState();
blockState.setType(Material.WALL_SIGN);
blockState.setData(signDirection);
boolean force = true;
boolean applyPhysics = false;
blockState.update(force, applyPhysics);
webSocketServerThread.log(Level.FINEST, "setting sign at "+location+" blockFace="+blockFace);
// Set the sign text
blockState = block.getState();
if (!(blockState instanceof Sign)) {
webSocketServerThread.log(Level.WARNING, "failed to place sign at "+location);
return;
}
Sign sign = (Sign) blockState;
// TODO: text lines by 15 characters into 5 lines
sign.setLine(0, text);
sign.update(force, applyPhysics);
webSocketServerThread.log(Level.FINEST, "set sign text="+text+", signDirection="+signDirection+", blockFace="+blockFace+", block="+block+", face="+face);
// SignChangeEvent not posted when signs created programmatically; notify web clients ourselves
notifySignChange(location, block.getType(), block.getState(), sign.getLines());
}