当前位置: 首页>>代码示例>>Java>>正文


Java Location.getBlockY方法代码示例

本文整理汇总了Java中org.bukkit.Location.getBlockY方法的典型用法代码示例。如果您正苦于以下问题:Java Location.getBlockY方法的具体用法?Java Location.getBlockY怎么用?Java Location.getBlockY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.Location的用法示例。


在下文中一共展示了Location.getBlockY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawCircle

import org.bukkit.Location; //导入方法依赖的package包/类
public List<Location> drawCircle(Location loc, Integer radius, Integer height, Boolean hollow, Boolean sphere,
		int plus_y) {
	List<Location> circleblocks = new ArrayList<Location>();
	Integer r = radius;
	Integer h = height;
	int cx = loc.getBlockX();
	int cy = loc.getBlockY();
	int cz = loc.getBlockZ();
	for (int x = cx - r.intValue(); x <= cx + r.intValue(); x++) {
		for (int z = cz - r.intValue(); z <= cz + r.intValue(); z++) {
			for (int y = sphere.booleanValue() ? cy - r.intValue() : cy; y < (sphere.booleanValue()
					? cy + r.intValue() : cy + h.intValue()); y++) {
				double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z)
						+ (sphere.booleanValue() ? (cy - y) * (cy - y) : 0);
				if ((dist < r.intValue() * r.intValue())
						&& ((!hollow.booleanValue()) || (dist >= (r.intValue() - 1) * (r.intValue() - 1)))) {
					Location l = new Location(loc.getWorld(), x, y + plus_y, z);
					circleblocks.add(l);
				}
			}
		}
	}
	return circleblocks;
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:25,代码来源:Utils.java

示例2: openFor

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void openFor(Player player) throws InvocationTargetException {
	if (AuthMeApi.getInstance().isAuthenticated(player)) {
		return;
	}
	PacketContainer fakeBlockChange = new PacketContainer(PacketType.Play.Server.BLOCK_CHANGE);
	PacketContainer updateEntity = new PacketContainer(PacketType.Play.Server.TILE_ENTITY_DATA);
	PacketContainer sign = new PacketContainer(PacketType.Play.Server.OPEN_SIGN_EDITOR);
	Location block = player.getLocation().getBlock().getLocation();
	BlockPosition position = new BlockPosition(block.getBlockX(), block.getBlockY() + 1, block.getBlockZ());
	fakeBlockChange.getBlockPositionModifier().write(0, position);
	fakeBlockChange.getBlockData().write(0, WrappedBlockData.createData(Material.SIGN_POST));
	protocolManager.sendServerPacket(player, fakeBlockChange);
	updateEntity.getBlockPositionModifier().write(0, position);
	updateEntity.getIntegers().write(0, 9);
	NbtCompound signNbt = (NbtCompound) updateEntity.getNbtModifier().read(0);
	signNbt = signNbt == null ? NbtFactory.ofCompound("") : signNbt;
	List<String> lines = this.getInfoFor(player);
	for (int i = 0; i < lines.size() || i < 4; i++) {
		signNbt.put("Text" + (i + 1), "{\"text\":\"" + lines.get(i) + "\"}");
	}
	updateEntity.getNbtModifier().write(0, signNbt);
	protocolManager.sendServerPacket(player, updateEntity);
	sign.getBlockPositionModifier().write(0, position);
	protocolManager.sendServerPacket(player, sign);
}
 
开发者ID:lj2000lj,项目名称:AuthMeGUI,代码行数:27,代码来源:SignLoginWindow.java

示例3: getBlocks

import org.bukkit.Location; //导入方法依赖的package包/类
public static double getBlocks(Location l){
	double _tem=0;
	int x=l.getBlockX()+2;
	int y=l.getBlockY()+2;
	int z=l.getBlockZ()+2;
	
	for(int sx=x-4;sx<x;sx++)
		for(int sy=y-4;sy<y;sy++)
			for(int sz=z-4;sz<z;sz++){
				Block temp=l.getWorld().getBlockAt(sx, sy, sz);
				if(rs.getHeatSource().containsKey(temp.getType().name()))
					_tem+=rs.getHeatSource().get(temp.getType().name())*Math.pow(
							1-rs.getDistanceEffect(), Math.sqrt(Math.pow(sx-x, 2)+Math.pow(
									sy-y, 2)+Math.pow(sz-z, 2)));
				
				//System.out.println(sx+" "+sy+" "+sz+" "+temp.getType().name());
			}
	return _tem;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:20,代码来源:TemperatureTask.java

示例4: getAmountOfSelectedBlocks

import org.bukkit.Location; //导入方法依赖的package包/类
/**
 * Returns the amount of selected blocks
 *
 * @return amount
 */
@Override
public int getAmountOfSelectedBlocks() {
    int amount = 0;
    final Location location = this.getDownCornerLocation().toLocation();
    for (int i = 0; i < this.getXWidth(); i++) {
        for (int j = 0; j < this.getYWidth(); j++) {
            for (int k = 0; k < this.getZWidth(); k++) {
                final Location loc = new Location(location.getWorld(), location.getBlockX() + i, location.getBlockY() + j, location.getBlockZ() + k);
                if (loc.getBlock().getType() != Material.AIR) {
                    amount++;
                }
            }
        }
    }
    return amount;
}
 
开发者ID:Shynixn,项目名称:AstralEdit,代码行数:22,代码来源:SelectionHolder.java

示例5: run

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void run() {
    Location location = player.getLocation();

    // Check if the player moved or is AFK.
    double x = location.getBlockX();
    double y = location.getBlockY();
    double z = location.getBlockZ();
    if (this.lastX == x && this.lastY == y && this.lastZ == z) {
        return;
    }

    this.lastX = x;
    this.lastY = y;
    this.lastZ = z;
    this.listener.handlePositionChanged(player, player.getWorld(), (int) x, (int) y, (int) z);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:18,代码来源:WallBorderListener.java

示例6: calculateDownLocation

import org.bukkit.Location; //导入方法依赖的package包/类
/**
 * Calculates the downLocation
 *
 * @param corner1 corner1
 * @param corner2 corner2
 */
private void calculateDownLocation(Location corner1, Location corner2) {
    final int x;
    if (corner1.getBlockX() < corner2.getBlockX()) {
        x = corner1.getBlockX();
    } else {
        x = corner2.getBlockX();
    }
    final int y;
    if (corner1.getBlockY() < corner2.getBlockY()) {
        y = corner1.getBlockY();
    } else {
        y = corner2.getBlockY();
    }
    final int z;
    if (corner1.getBlockZ() < corner2.getBlockZ()) {
        z = corner1.getBlockZ();
    } else {
        z = corner2.getBlockZ();
    }
    this.downCorner = new LocationBuilder(new Location(corner1.getWorld(), x, y, z));
}
 
开发者ID:Shynixn,项目名称:AstralEdit,代码行数:28,代码来源:SelectionHolder.java

示例7: destroyAllDuctsOnIsland

import org.bukkit.Location; //导入方法依赖的package包/类
private void destroyAllDuctsOnIsland(Location islandLoc) {
	int dist = 200;
	final Location min = islandLoc.clone().add(-dist, 0, -dist);
	min.setY(0);
	final Location max = islandLoc.clone().add(dist, 0, dist);
	max.setY(max.getWorld().getMaxHeight());

	com.wasteofplastic.acidisland.ASkyBlockAPI skyblockApi = com.wasteofplastic.acidisland.ASkyBlockAPI.getInstance();

	Location tempLoc = new Location(min.getWorld(), 0, 0, 0);
	for (int x = min.getBlockX(); x < max.getBlockX(); x++) {
		for (int y = min.getBlockY(); y < max.getBlockY(); y++) {
			for (int z = min.getBlockZ(); z < max.getBlockZ(); z++) {
				tempLoc.setX(x);
				tempLoc.setY(y);
				tempLoc.setZ(z);
				if (PipeAPI.isDuct(tempLoc, null) && !skyblockApi.islandAtLocation(tempLoc)) {
					PipeAPI.destroyDuct(tempLoc);
				}
			}
		}
	}
}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:24,代码来源:SkyblockAPIUtils.java

示例8: surrendPlayer

import org.bukkit.Location; //导入方法依赖的package包/类
public static void surrendPlayer(Player player){
       YamlConfiguration PlayerData = PVPAsWantedManager.onLoadData(player.getName());
       int value = PlayerData.getInt("jail.times");
	int times = PlayerData.getInt("wanted.points")*Integer.valueOf(Config.getConfig("timeTick.jailPlayerTimes").replace("min", "").replace("m", ""));
	if(value > 0){
		player.sendMessage(Message.getMsg("player.isAlreadyInJailMessage"));
		return;
	}
	if(times <1){
		player.sendMessage(Message.getMsg("player.notSurrendMessage"));
		return;
	}
	Location location = player.getLocation();
       int playerX = location.getBlockX();
       int playerY = location.getBlockY();
       int playerZ = location.getBlockZ();
       String playerWorld = location.getWorld().getName();
       PlayerData.set("attribute.X", playerX);
       PlayerData.set("attribute.Y", playerY);
       PlayerData.set("attribute.Z", playerZ);
       PlayerData.set("attribute.World", playerWorld);
       PlayerData.set("wanted.points", Integer.valueOf(0));
       PlayerData.set("jail.times", times);
       PVPAsWantedManager.onDeleteList(player.getName(), "WantedList");
       PVPAsWantedManager.onCreateList(player.getName(), "JailedList");
       PVPAsWantedManager.onSaveData(player.getName(), PlayerData);
	JailManager.playerJoinJail(player,location);
	player.sendMessage(Message.getMsg("player.surrendMessage",String.valueOf(times)));
}
 
开发者ID:Saukiya,项目名称:PVPAsWantedManager,代码行数:30,代码来源:JailManager.java

示例9: spawnFallingBlock

import org.bukkit.Location; //导入方法依赖的package包/类
public FallingBlock spawnFallingBlock(Location location, org.bukkit.Material material, byte data) throws IllegalArgumentException {
    Validate.notNull(location, "Location cannot be null");
    Validate.notNull(material, "Material cannot be null");
    Validate.isTrue(material.isBlock(), "Material must be a block");

    double x = location.getBlockX() + 0.5;
    double y = location.getBlockY() + 0.5;
    double z = location.getBlockZ() + 0.5;

    net.minecraft.entity.item.EntityFallingBlock entity = new net.minecraft.entity.item.EntityFallingBlock(world, x, y, z, net.minecraft.block.Block.getBlockById(material.getId()), data);
    entity.field_145812_b = 1; // ticksLived

    world.addEntity(entity, SpawnReason.CUSTOM);
    return (FallingBlock) entity.getBukkitEntity();
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:16,代码来源:CraftWorld.java

示例10: isHoveringOverWater

import org.bukkit.Location; //导入方法依赖的package包/类
public static boolean isHoveringOverWater(Location player, int blocks) {
    for (int i = player.getBlockY(); i > player.getBlockY() - blocks; i--) {
        Block newloc = (new Location(player.getWorld(), player.getBlockX(), i, player.getBlockZ())).getBlock();
        if (newloc.getType() != Material.AIR) {
            return newloc.isLiquid();
        }
    }

    return false;
}
 
开发者ID:Notoh,项目名称:DynamicAC,代码行数:11,代码来源:Utilities.java

示例11: getBungeeCordSignInfo

import org.bukkit.Location; //导入方法依赖的package包/类
private BungeeCordSignInfo getBungeeCordSignInfo(Location location2) {
    for (final BungeeCordSignInfo info : this.controller.signs.toArray(new BungeeCordSignInfo[this.controller.signs.size()])) {
        final Location location1 = info.getLocation();
        if (location1.getBlockX() == location2.getBlockX()) {
            if (location1.getBlockY() == location2.getBlockY()) {
                if (location1.getBlockZ() == location2.getBlockZ()) {
                    return info;
                }
            }
        }
    }
    return null;
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:14,代码来源:BungeeCordListener.java

示例12: restore

import org.bukkit.Location; //导入方法依赖的package包/类
public void restore(Location location)
{
    Location finalLocation = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());

    if (this.blocksUsed.containsKey(finalLocation) && this.blocksBefore.containsKey(finalLocation))
    {
        this.blocksUsed.remove(finalLocation);
        finalLocation.getBlock().setType(this.blocksBefore.get(finalLocation).getType());
        finalLocation.getBlock().setData(this.blocksBefore.get(finalLocation).getData());
        this.blocksBefore.remove(finalLocation);
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:13,代码来源:AbstractDisplayer.java

示例13: getNearbyBlocks

import org.bukkit.Location; //导入方法依赖的package包/类
private static List<Block> getNearbyBlocks(Location location, int radius)
{
    List<Block> blocks = new ArrayList<>();

    for(int x = location.getBlockX() - radius; x <= location.getBlockX() + radius; x++)
        for(int y = location.getBlockY() - radius; y <= location.getBlockY() + radius; y++)
            for(int z = location.getBlockZ() - radius; z <= location.getBlockZ() + radius; z++)
                blocks.add(location.getWorld().getBlockAt(x, y, z));

    return blocks;
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:12,代码来源:PaintballDisplayer.java

示例14: format

import org.bukkit.Location; //导入方法依赖的package包/类
public static String format(Location loc, boolean world) {
    return (world ? (loc.getWorld().getName() + ":") : "") + loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ();
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:4,代码来源:LocUtil.java

示例15: onJoinJail

import org.bukkit.Location; //导入方法依赖的package包/类
@PlayerCommand(cmd="joinJail",arg = " <player> <times>")
public void onJoinJail(CommandSender sender,String args[]){
	if(sender instanceof Player){
		if(!sender.hasPermission("pvpaswantedmanager." + args[0])) {
			sender.sendMessage(Message.getMsg("player.noPermissionMessage"));
			return;
		}
	}
	if(args.length <=2 ){
		sender.sendMessage(Message.getMsg("admin.joinJailCorrectionsMessage"));
		return;
	}
	String playerName = args[1];
	if(!Pattern.compile("[0-9]*").matcher(args[2]).matches()){
		sender.sendMessage(Message.getMsg("admin.wrongFormatMessage"));
		return;
	}
	int times = Integer.valueOf(args[2]);
	if(isPlayerOnline(playerName)){
		Player player = Bukkit.getPlayer(playerName);
        YamlConfiguration PlayerData = PVPAsWantedManager.onLoadData(player.getName());
		if(PlayerData ==null)return;
        int value = PlayerData.getInt("jail.times");
		if(value > 0){
			sender.sendMessage(Message.getMsg("admin.playerIsAlreadyInJailMessage"));
			return;
		}
		Location location = player.getLocation();
        int playerX = location.getBlockX();
        int playerY = location.getBlockY();
        int playerZ = location.getBlockZ();
        String playerWorld = location.getWorld().getName();
        PlayerData.set("attribute.X", playerX);
        PlayerData.set("attribute.Y", playerY);
        PlayerData.set("attribute.Z", playerZ);
        PlayerData.set("attribute.World", playerWorld);
        PlayerData.set("jail.times", times);
        onDeleteList(player.getName(), "WantedList");
        onCreateList(player.getName(), "JailedList");
        onSaveData(player.getName(), PlayerData);
		JailManager.playerJoinJail(player,location);
		sender.sendMessage(Message.getMsg("admin.joinJailPlayerMessage", args[1],args[2]));
		player.sendMessage(Message.getMsg("player.jailedJoinMessage",args[2]));
	}else{
		sender.sendMessage(Message.getMsg("admin.playerOfflineMessage"));
	}
}
 
开发者ID:Saukiya,项目名称:PVPAsWantedManager,代码行数:48,代码来源:PVPAsWantedManager.java


注:本文中的org.bukkit.Location.getBlockY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。