當前位置: 首頁>>代碼示例>>Java>>正文


Java Block.getWorld方法代碼示例

本文整理匯總了Java中org.bukkit.block.Block.getWorld方法的典型用法代碼示例。如果您正苦於以下問題:Java Block.getWorld方法的具體用法?Java Block.getWorld怎麽用?Java Block.getWorld使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.block.Block的用法示例。


在下文中一共展示了Block.getWorld方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: CraftBlockState

import org.bukkit.block.Block; //導入方法依賴的package包/類
public CraftBlockState(final Block block) {
    this.world = (CraftWorld) block.getWorld();
    this.x = block.getX();
    this.y = block.getY();
    this.z = block.getZ();
    this.type = block.getTypeId();
    this.light = block.getLightLevel();
    this.chunk = (CraftChunk) block.getChunk();
    this.flag = 3;
    // Cauldron start - save TE data
    TileEntity te = world.getHandle().getTileEntity(x, y, z);
    if (te != null)
    {
        nbt = new NBTTagCompound();
        te.writeToNBT(nbt);
    }
    else nbt = null;
    // Cauldron end

    createData(block.getData());
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:22,代碼來源:CraftBlockState.java

示例2: getArmorStand

import org.bukkit.block.Block; //導入方法依賴的package包/類
public static ArmorStand getArmorStand(Block hopper, boolean createIfNoneFound) {
	Location l = new Location(hopper.getWorld(), hopper.getX() + 0.5, hopper.getY() + offset, hopper.getZ() + 0.5);
	
	for (Entity n: l.getChunk().getEntities()) {
		if (n instanceof ArmorStand) {
			if (n.getCustomName() == null && l.distanceSquared(n.getLocation()) < 0.4D) return (ArmorStand) n;
		}
	}

	if (!createIfNoneFound) {
		return null;
	}
	
	ArmorStand hologram = ArmorStandFactory.createHidden(l);
	hologram.setCustomNameVisible(false);
	hologram.setCustomName(null);
	return hologram;
}
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:19,代碼來源:InfusedHopper.java

示例3: 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

示例4: getArmorStand

import org.bukkit.block.Block; //導入方法依賴的package包/類
public static ArmorStand getArmorStand(Block hopper)
{
    Location l = new Location(hopper.getWorld(), (double)hopper.getX() + 0.5D, hopper.getY(), (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,代碼來源:AutoBreeder.java

示例5: getArmorStand

import org.bukkit.block.Block; //導入方法依賴的package包/類
private static ArmorStand getArmorStand(Block b)
{
    Location l = new Location(b.getWorld(), (double)b.getX() + 0.5D, (double)b.getY() + 1.2D, (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);
    hologram.setCustomNameVisible(false);
    hologram.setCustomName(null);
    return hologram;
}
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:18,代碼來源:AndroidStatusHologram.java

示例6: 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

示例7: CraftSkull

import org.bukkit.block.Block; //導入方法依賴的package包/類
public CraftSkull(final Block block) {
    super(block);

    CraftWorld world = (CraftWorld) block.getWorld();
    skull = (TileEntitySkull) world.getTileEntityAt(getX(), getY(), getZ());
    profile = skull.func_152108_a();
    skullType = getSkullType(skull.func_145904_a());
    rotation = (byte) skull.getRotation();
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:10,代碼來源:CraftSkull.java

示例8: 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

示例9: removeMetadata

import org.bukkit.block.Block; //導入方法依賴的package包/類
/**
 * Removes metadata from from a {@link Block} belonging to a given {@link Plugin}, ensuring the block being deleted from belongs
 * to this BlockMetadataStore's owning world.
 * @see MetadataStoreBase#removeMetadata(Object, String, org.bukkit.plugin.Plugin)
 */
@Override
public void removeMetadata(Block block, String metadataKey, Plugin owningPlugin) {
    if(block.getWorld() == owningWorld) {
        super.removeMetadata(block, metadataKey, owningPlugin);
    } else {
        throw new IllegalArgumentException("Block does not belong to world " + owningWorld.getName());
    }
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:14,代碼來源:BlockMetadataStore.java

示例10: getNearbyBlocks2D

import org.bukkit.block.Block; //導入方法依賴的package包/類
/**
 * Method to return all blocks in a 2-dimensional space (x,z)
 * 
 * @param center
 *            The center block.
 * @param radius
 *            The radius.
 * @return A list containing all blocks.
 */
public static List<Block> getNearbyBlocks2D(Block center, int radius) {

	List<Block> blocks = new ArrayList<>();

	for (int x = center.getX() - radius; x <= center.getX() + radius; x++) {
		for (int z = center.getZ() - radius; z <= center.getZ() + radius; z++) {
			Location loc = new Location(center.getWorld(), x, center.getY(), z);

			blocks.add(loc.getBlock());
		}
	}
	return blocks;
}
 
開發者ID:kadeska,項目名稱:MT_Core,代碼行數:23,代碼來源:WorldUtils.java

示例11: CraftJukebox

import org.bukkit.block.Block; //導入方法依賴的package包/類
public CraftJukebox(final Block block) {
    super(block);

    world = (CraftWorld) block.getWorld();
    jukebox = (TileEntityJukebox) world.getTileEntityAt(getX(), getY(), getZ());
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:7,代碼來源:CraftJukebox.java

示例12: CraftDropper

import org.bukkit.block.Block; //導入方法依賴的package包/類
public CraftDropper(final Block block) {
    super(block);

    world = (CraftWorld) block.getWorld();
    dropper = (TileEntityDropper) world.getTileEntityAt(getX(), getY(), getZ());
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:7,代碼來源:CraftDropper.java

示例13: CraftDispenser

import org.bukkit.block.Block; //導入方法依賴的package包/類
public CraftDispenser(final Block block) {
    super(block);

    world = (CraftWorld) block.getWorld();
    dispenser = (TileEntityDispenser) world.getTileEntityAt(getX(), getY(), getZ());
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:7,代碼來源:CraftDispenser.java

示例14: BlockEventQuery

import org.bukkit.block.Block; //導入方法依賴的package包/類
public BlockEventQuery(Event event, Block block) {
    this(event, block.getWorld(), block.getX(), block.getY(), block.getZ(), null);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:4,代碼來源:BlockEventQuery.java

示例15: CraftBeacon

import org.bukkit.block.Block; //導入方法依賴的package包/類
public CraftBeacon(final Block block) {
    super(block);

    world = (CraftWorld) block.getWorld();
    beacon = (TileEntityBeacon) world.getTileEntityAt(getX(), getY(), getZ());
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:7,代碼來源:CraftBeacon.java


注:本文中的org.bukkit.block.Block.getWorld方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。