本文整理匯總了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());
}