当前位置: 首页>>代码示例>>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;未经允许,请勿转载。