本文整理汇总了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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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());
}
}
示例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;
}
示例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());
}
示例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());
}
示例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());
}
示例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);
}
示例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());
}