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


Java Block.getZ方法代码示例

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


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

示例1: getLookedAtFakeEntity

import org.bukkit.block.Block; //导入方法依赖的package包/类
public static FakeEntity getLookedAtFakeEntity(Player p, int range) throws NoSuchFakeEntityException {
    if (!getFakeEntities().containsKey(p.getName())) throw new NoSuchFakeEntityException();

    for (Block b : p.getLineOfSight(null, range)) {
        for (FakeEntity fakeEntity : getFakeEntities().get(p.getName())) {
            if ((b.getX() == fakeEntity.getCurrentlocation().getBlockX()
                    && b.getY() == fakeEntity.getCurrentlocation().getBlockY()
                    && b.getZ() == fakeEntity.getCurrentlocation().getBlockZ()
                    || (b.getX() == fakeEntity.getCurrentlocation().getBlockX()
                    && b.getY() == (fakeEntity.getCurrentlocation().getBlockY() + 1)
                    && b.getZ() == fakeEntity.getCurrentlocation().getBlockZ())))
                return fakeEntity;
        }
    }
    throw new NoSuchFakeEntityException();
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:17,代码来源:FakeAPI.java

示例2: handleRemoval

import org.bukkit.block.Block; //导入方法依赖的package包/类
/**
 * Generically handle a blanket, no-drop removal of tracking data. This does not attempt to cover edge cases, just removes things and prays.
 * 
 * @param block The block of interest
 * @param chunk The chunk the block lives in.
 */
private void handleRemoval(final Block block, WorldChunk chunk) {
	int x = block.getX();
	int y = block.getY();
	int z = block.getZ();
	Crop crop = chunk.getCrop(x, y, z);
	Sapling sapling = chunk.getSapling(x, y, z);
	TreeComponent treeComponent = chunk.getTreeComponent(x, y, z);
	if (crop != null) {
		crop.setRemoved();
	}
	if (sapling != null) {
		sapling.setRemoved();
	}
	if (treeComponent != null) {
		Tree tree = CropControl.getDAO().getTree(treeComponent);
		
		treeComponent.setRemoved();
		
		if (CropControl.getDAO().getTreeComponents(treeComponent.getTreeID()).isEmpty()) {
			tree.setRemoved();
		}
	}
}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:30,代码来源:CropControlEventHandler.java

示例3: onBlockBreak

import org.bukkit.block.Block; //导入方法依赖的package包/类
@EventHandler
  public void onBlockBreak(BlockBreakEvent event) {
if (Walls.getSpectators().contains(event.getPlayer().getName())) {
	event.setCancelled(true);
	return;
}
  	
      if (State.PVP)
          return;
      
      Block b = event.getBlock();
      if (b == null)
          return;
      Team team = Team.getTeam(event.getPlayer());
      if (b.getX() < team.getMin().getX() + 1 || b.getZ() < team.getMin().getZ() + 1) {
          event.setCancelled(true);
      }
      if (b.getX() > team.getMax().getX() - 1 || b.getZ() > team.getMax().getZ() - 1) {
          event.setCancelled(true);
      }
  }
 
开发者ID:thekeenant,项目名称:mczone,代码行数:22,代码来源:Events.java

示例4: getArmorStand

import org.bukkit.block.Block; //导入方法依赖的package包/类
public static ArmorStand getArmorStand(Block projector)
{
    String nametag = ChatColor.translateAlternateColorCodes('&', BlockStorage.getBlockInfo(projector, "text"));
    double offset = Double.valueOf(BlockStorage.getBlockInfo(projector, "offset")).doubleValue();
    Location l = new Location(projector.getWorld(), (double)projector.getX() + 0.5D, (double)projector.getY() + offset, (double)projector.getZ() + 0.5D);
    Entity aentity[];
    int j = (aentity = l.getChunk().getEntities()).length;
    for(int i = 0; i < j; i++)
    {
        Entity n = aentity[i];
        if((n instanceof ArmorStand) && n.getCustomName() != null && n.getCustomName().equals(nametag) && l.distanceSquared(n.getLocation()) < 0.40000000000000002D)
            return (ArmorStand)n;
    }

    ArmorStand hologram = ArmorStandFactory.createHidden(l);
    hologram.setCustomName(nametag);
    return hologram;
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:19,代码来源:Projector.java

示例5: getArmorStand

import org.bukkit.block.Block; //导入方法依赖的package包/类
public static ArmorStand getArmorStand(Block hopper)
{
    Location l = new Location(hopper.getWorld(), (double)hopper.getX() + 0.5D, (double)hopper.getY() + 1.2D, (double)hopper.getZ() + 0.5D);
    Entity aentity[];
    int j = (aentity = l.getChunk().getEntities()).length;
    for(int i = 0; i < j; i++)
    {
        Entity n = aentity[i];
        if((n instanceof ArmorStand) && n.getCustomName() == null && l.distanceSquared(n.getLocation()) < 0.40000000000000002D)
            return (ArmorStand)n;
    }

    ArmorStand hologram = ArmorStandFactory.createHidden(l);
    hologram.setCustomNameVisible(false);
    hologram.setCustomName(null);
    return hologram;
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:18,代码来源:AnimalGrowthAccelerator.java

示例6: isBreakableTracked

import org.bukkit.block.Block; //导入方法依赖的package包/类
public boolean isBreakableTracked(Block block) {
	WorldChunk chunk = WorldChunk.getChunk(block.getChunk());
	int x = block.getX();
	int y = block.getY();
	int z = block.getZ();
	return (chunk.getCrop(x, y, z) != null) || (chunk.getSapling(x, y, z) != null);
}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:8,代码来源:DAO.java

示例7: getKitSign

import org.bukkit.block.Block; //导入方法依赖的package包/类
public Sign getKitSign(Sign s) {
	for (Block b : kitSigns) 
		if (b.getX() == s.getX() && b.getY() == s.getY() && b.getZ() == s.getZ())
			if (b.getType() == Material.SIGN || b.getType() == Material.WALL_SIGN)
				return (Sign) b.getState();
	return null;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:8,代码来源:Lobby.java

示例8: isFakeEntityInRange

import org.bukkit.block.Block; //导入方法依赖的package包/类
public static boolean isFakeEntityInRange(Player p, int range) {
    if (!getFakeEntities().containsKey(p.getName())) return false;
    for (Block b : p.getLineOfSight(null, range)) {
        for (FakeEntity fakeEntity : getFakeEntities().get(p.getName())) {
            if ((b.getX() == fakeEntity.getCurrentlocation().getBlockX()
                    && b.getY() == fakeEntity.getCurrentlocation().getBlockY()
                    && b.getZ() == fakeEntity.getCurrentlocation().getBlockZ()
                    || (b.getX() == fakeEntity.getCurrentlocation().getBlockX()
                    && b.getY() == (fakeEntity.getCurrentlocation().getBlockY() + 1)
                    && b.getZ() == fakeEntity.getCurrentlocation().getBlockZ())))
                return true;
        }
    }
    return false;
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:16,代码来源:FakeAPI.java

示例9: setBlockSuperFast

import org.bukkit.block.Block; //导入方法依赖的package包/类
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_12_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_12_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
    BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
    int combined = blockId + (data << 12);
    IBlockData ibd = net.minecraft.server.v1_12_R1.Block.getByCombinedId(combined);
    if (applyPhysics) {
        w.setTypeAndData(bp, ibd, 3); 
    } else {
        w.setTypeAndData(bp, ibd, 2); 
    }
    chunk.a(bp, ibd);
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:15,代码来源:NMSHandler.java

示例10: getSafeLocationUnder

import org.bukkit.block.Block; //导入方法依赖的package包/类
private static Vector getSafeLocationUnder(Block block) {
    World world = block.getWorld();
    for(int y = block.getY() - 2; y >= 0; y--) {
        Block feet = world.getBlockAt(block.getX(), y, block.getZ());
        Block head = world.getBlockAt(block.getX(), y + 1, block.getZ());
        if(feet.getType() == Material.AIR && head.getType() == Material.AIR) {
            return new Vector(block.getX() + 0.5, y, block.getZ() + 0.5);
        }
    }
    return new Vector(block.getX() + 0.5, -2, block.getZ() + 0.5);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:12,代码来源:LaneMatchModule.java

示例11: getArmorStand

import org.bukkit.block.Block; //导入方法依赖的package包/类
private static ArmorStand getArmorStand(Block b)
{
    Location l = new Location(b.getWorld(), (double)b.getX() + 0.5D, (float)b.getY() - 0.7F, (double)b.getZ() + 0.5D);
    Entity aentity[];
    int j = (aentity = l.getChunk().getEntities()).length;
    for(int i = 0; i < j; i++)
    {
        Entity n = aentity[i];
        if((n instanceof ArmorStand) && n.getCustomName() != null && l.distanceSquared(n.getLocation()) < 0.40000000000000002D)
            return (ArmorStand)n;
    }

    ArmorStand hologram = ArmorStandFactory.createHidden(l);
    return hologram;
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:16,代码来源:EnergyHologram.java

示例12: run

import org.bukkit.block.Block; //导入方法依赖的package包/类
public void run() {
  	Block xwall = new Location(Bukkit.getWorld("world"),-864,73,-164).getBlock();
for (int x = xwall.getX(); x < -720; x++) {
	// Go up the y axis and set to air
	for(int y = 73; y < 100; y++){
		if (isWall(Config.getWorld().getBlockAt(x, y, -164)))
			Config.getWorld().getBlockAt(x, y, -164).setType(Material.AIR);
	}
}

Block xwall2 = new Location(Bukkit.getWorld("world"),-864,73,-182).getBlock();
for (int x = xwall2.getX(); x < -720; x++) {
	// Go up the y axis and set to air
	for(int y = 73; y < 100; y++){
		if (isWall(Config.getWorld().getBlockAt(x, y, -182)))
			Config.getWorld().getBlockAt(x, y, -182).setType(Material.AIR);
	}
}

Block ywall = new Location(Bukkit.getWorld("world"),-785,73,-243).getBlock();
for (int z = ywall.getZ(); z < -100; z++) {
	// Go up the y axis and set to air
	for(int y = 73; y < 100; y++){
		if (isWall(Config.getWorld().getBlockAt(-785, y, z)))
			Config.getWorld().getBlockAt(-785, y, z).setType(Material.AIR);
	}
}

Block ywall2 = new Location(Bukkit.getWorld("world"),-803,73,-243).getBlock();
for (int z = ywall2.getZ(); z < -100; z++) {
	// Go up the y axis and set to air
	for(int y = 73; y < 100; y++){
		if (isWall(Config.getWorld().getBlockAt(-803, y, z)))
			Config.getWorld().getBlockAt(-803, y, z).setType(Material.AIR);
	}
}
  }
 
开发者ID:thekeenant,项目名称:mczone,代码行数:38,代码来源:Utils.java

示例13: toTag

import org.bukkit.block.Block; //导入方法依赖的package包/类
public static Tag toTag(Block block)
{
	return new Tag(
			"world", block.getWorld().getName(),
			"x", block.getX(),
			"y", block.getY(),
			"z", block.getZ()
	);
}
 
开发者ID:timtomtim7,项目名称:SparseBukkitAPI,代码行数:10,代码来源:TagUtils.java

示例14: onPlaceBlock

import org.bukkit.block.Block; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlaceBlock(BlockPlaceEvent e) {
	Block block = e.getBlock();

	Material blockMaterial = block.getType();
	int x = block.getX();
	int y = block.getY();
	int z = block.getZ();
	WorldChunk chunk = CropControl.getDAO().getChunk(block.getChunk());

	if (CropControl.getDAO().isTracked(block) == true) {
		// We've got a replacement
		CropControl.getPlugin().debug("Ghost object? Placement is overtop a tracked object at {0}, {1}, {2}", x, y, z);
		handleRemoval(block, chunk);
	}
	if (harvestableCrops.containsKey(blockMaterial)) {
		// we placed a block overtop an existing crop. Will be handled by a break event?
		/*Crop crop = chunk.getCrop(x, y, z);
		if (crop != null) {
			crop.setRemoved();
			CropControl.getPlugin().debug("Missed an event? Replacing a Crop at {0}, {1}, {2}", x, y, z);
			//return;
		}*/
		
		// We've placed a crop!
		Crop.create(chunk, x, y, z, blockMaterial.toString(), getBaseCropState(blockMaterial),
				e.getPlayer().getUniqueId(), System.currentTimeMillis(), harvestableCrops.get(blockMaterial));
	} else if (blockMaterial == Material.SAPLING) {
		// we placed a block overtop an existing sapling. TODO: Do I need to remove sapling here, or will there be a break event?
		/*Sapling sapling = chunk.getSapling(x, y, z);
		if (sapling != null) {
			sapling.setRemoved();
			CropControl.getPlugin().debug("Missed an event? Replacing a Sapling at {0}, {1}, {2}", x, y, z);
			//return;
		}*/
		// We've placed a sapling!
		Sapling.create(chunk, x, y, z, getSaplingType(block.getData()),
				e.getPlayer().getUniqueId(), System.currentTimeMillis(), false);
	} else if (blockMaterial == Material.CHORUS_FLOWER) {
		/*if (CropControl.getDAO().isTracked(block) == true) {
			CropControl.getPlugin().debug("Ghost object? Placement is overtop a tracked object at {0}, {1}, {2}", x, y, z);
			//return;
		}*/
		
		// TODO: Check if connected to an existing chorus tree.

		// First register the "tree"
		Tree chorusPlant = Tree.create(chunk, x, y, z, Material.CHORUS_PLANT.toString(),
				e.getPlayer().getUniqueId(), System.currentTimeMillis());

		// Then the component in the tree.
		TreeComponent.create(chorusPlant, chunk, x, y, z, Material.CHORUS_PLANT.toString(),
				e.getPlayer().getUniqueId(), false);
	} else if (blockMaterial.isSolid()){ // check for cactus.
		for (BlockFace face : CropControlEventHandler.directions) {
			Block adj = block.getRelative(face);
			if (Material.CACTUS.equals(adj.getType())) {
				Location loc = adj.getLocation();
				if (!pendingChecks.contains(loc)) {
					pendingChecks.add(loc);
					handleBreak(adj, BreakType.PLAYER, e.getPlayer().getUniqueId(), null);
				}		
			}
		}
	}
}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:67,代码来源:CropControlEventHandler.java

示例15: onBlockBreak

import org.bukkit.block.Block; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onBlockBreak(BlockBreakEvent event) {
	Player p = event.getPlayer();
	if ( PermissionInterface.CheckEnabledWorld(p.getLocation())) {
		Block checkBlock;
		checkBlock = event.getBlock();
		int craftBlockId = checkBlock.getTypeId();

		Craft checkCraft = Craft.getCraft(checkBlock.getX(), checkBlock.getY(), checkBlock.getZ());

		if (checkCraft != null) {
			if ((craftBlockId == 46) && (p.getGameMode() != GameMode.CREATIVE)) {
				p.sendMessage(ChatColor.RED + "Can't break vehicle TNT.");
				event.setCancelled(true);
				return;
			} else if ((craftBlockId == 75) || (craftBlockId == 76) || (craftBlockId == 65) || (craftBlockId == 68) || (craftBlockId == 63) || (craftBlockId == 69) || (craftBlockId == 77) || (craftBlockId == 70) || (craftBlockId == 72) || (craftBlockId == 55) || (craftBlockId == 143) || (craftBlockId == 64) || (craftBlockId == 71)) {
				int arrayX = checkBlock.getX() - checkCraft.minX;
				int arrayY = checkBlock.getY() - checkCraft.minY;
				int arrayZ = checkBlock.getZ() - checkCraft.minZ;
				checkCraft.matrix[arrayX][arrayY][arrayZ] = -1;

				if (((craftBlockId == 64) && (checkBlock.getRelative(BlockFace.UP).getTypeId() == 64)) || ((craftBlockId == 71) && (checkBlock.getRelative(BlockFace.UP).getTypeId() == 71))) {
					checkBlock.getRelative(BlockFace.UP).setTypeId(0);
					checkCraft.matrix[arrayX][arrayY + 1][arrayZ] = -1;
				}
				if (((craftBlockId == 64) && (checkBlock.getRelative(BlockFace.DOWN).getTypeId() == 64)) || ((craftBlockId == 71) && (checkBlock.getRelative(BlockFace.DOWN).getTypeId() == 71))) {
					checkBlock.getRelative(BlockFace.DOWN).setTypeId(0);
					checkCraft.matrix[arrayX][arrayY - 1][arrayZ] = -1;
				}
				for (DataBlock complexBlock : checkCraft.complexBlocks) {
					if (complexBlock.locationMatches(arrayX, arrayY, arrayZ)) {
						checkCraft.complexBlocks.remove(complexBlock);
						break;
					}
				}
				for (DataBlock dataBlock : checkCraft.dataBlocks) {
					if (dataBlock.locationMatches(arrayX, arrayY, arrayZ)) {
						checkCraft.dataBlocks.remove(dataBlock);
						break;
					}
				}
			}
		}
	}
}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:46,代码来源:MoveCraft_BlockListener.java


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