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


Java Block.getY方法代码示例

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


在下文中一共展示了Block.getY方法的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 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

示例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, 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

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

示例5: isTracked

import org.bukkit.block.Block; //导入方法依赖的package包/类
public boolean isTracked(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) || (chunk.getTreeComponent(x, y, z) != null);
}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:8,代码来源:DAO.java

示例6: LocationDiff

import org.bukkit.block.Block; //导入方法依赖的package包/类
public LocationDiff(Block b, Location location) {
    this.blockType = b.getType();
    this.blockData = b.getState().getData();
    this.blockPower = b.getBlockPower();
    this.x = b.getX() - location.getBlockX();
    this.y = b.getY() - location.getBlockY();
    this.z = b.getZ() - location.getBlockZ();
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:9,代码来源:Schematic.java

示例7: onBlockSpread

import org.bukkit.block.Block; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockSpread(BlockSpreadEvent e) {
	Block source = e.getSource();
	WorldChunk sourceChunk = CropControl.getDAO().getChunk(source.getChunk());
	int sourceX = source.getX();
	int sourceY = source.getY();
	int sourceZ = source.getZ();

	Block block = e.getBlock();
	WorldChunk chunk = CropControl.getDAO().getChunk(block.getChunk());
	int x = block.getX();
	int y = block.getY();
	int z = block.getZ();

	if (!harvestableCrops.containsKey(source.getType()) && source.getType() != Material.CHORUS_FLOWER
			&& source.getType() != Material.CHORUS_PLANT && block.getType() != Material.CHORUS_FLOWER
			&& block.getType() != Material.CHORUS_PLANT)
		return;

	Crop sourceCrop = sourceChunk.getCrop(sourceX, sourceY, sourceZ);
	if (sourceCrop != null) {
		UUID placerUUID = sourceCrop.getPlacer();
		Crop.create(chunk, x, y, z, source.getType().toString(), null, placerUUID,
				System.currentTimeMillis(), true);
		return;
	} 
	
	TreeComponent treeComponent = sourceChunk.getTreeComponent(sourceX, sourceY, sourceZ);
	if (treeComponent != null) {
		treeComponent.setHarvestable(true);

		// TODO: should we differentiate between flower and plant here?
		TreeComponent.create(treeComponent.getTreeID(), chunk, x, y, z, Material.CHORUS_PLANT.toString(),
				treeComponent.getPlacer(), true);
	}

}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:38,代码来源:CropControlEventHandler.java

示例8: setFacingDirection

import org.bukkit.block.Block; //导入方法依赖的package包/类
public boolean setFacingDirection(BlockFace face, boolean force) {
    Block block = getLocation().getBlock().getRelative(getAttachedFace()).getRelative(face.getOppositeFace()).getRelative(getFacing());
    net.minecraft.entity.EntityHanging hanging = getHandle();
    int x = hanging.field_146063_b, y = hanging.field_146064_c, z = hanging.field_146062_d, dir = hanging.hangingDirection;
    hanging.field_146063_b = block.getX();
    hanging.field_146064_c = block.getY();
    hanging.field_146062_d = block.getZ();
    switch (face) {
        case SOUTH:
        default:
            getHandle().setDirection(0);
            break;
        case WEST:
            getHandle().setDirection(1);
            break;
        case NORTH:
            getHandle().setDirection(2);
            break;
        case EAST:
            getHandle().setDirection(3);
            break;
    }
    if (!force && !hanging.onValidSurface()) {
        // Revert since it doesn't fit
        hanging.field_146063_b = x;
        hanging.field_146064_c = y;
        hanging.field_146062_d = z;
        hanging.setDirection(dir);
        return false;
    }
    return true;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:33,代码来源:CraftHanging.java

示例9: getFace

import org.bukkit.block.Block; //导入方法依赖的package包/类
public BlockFace getFace(final Block block) {
    BlockFace[] values = BlockFace.values();

    for (BlockFace face : values) {
        if ((this.getX() + face.getModX() == block.getX()) &&
            (this.getY() + face.getModY() == block.getY()) &&
            (this.getZ() + face.getModZ() == block.getZ())
        ) {
            return face;
        }
    }

    return null;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:15,代码来源:CraftBlock.java

示例10: tabComplete

import org.bukkit.block.Block; //导入方法依赖的package包/类
@Override
public List<String> tabComplete(CommandSender sender, String[] args) {
    Player player = (Player) sender;
    Block block = player.getTargetBlock((Set<Material>) null, 100);
    if(args.length == 0) {
        return new ArrayList<>(block.getX());
    } else if(args.length == 1){
        return new ArrayList<>(block.getY());
    } else if(args.length == 2){
        return new ArrayList<>(block.getZ());
    } else {
        return new ArrayList<>();
    }
}
 
开发者ID:Warvale,项目名称:Scorch,代码行数:15,代码来源:LootChestCommand.java

示例11: openDialogue

import org.bukkit.block.Block; //导入方法依赖的package包/类
public static void openDialogue(Player p, Block b)
{
    if(ignored.contains(p.getUniqueId()))
    {
        ignored.remove(p.getUniqueId());
        return;
    }
    TellRawMessage tellraw = new TellRawMessage();
    tellraw.addText("&3- 选择你要去的楼层 -  ");
    int index = 1;
    for(int y = b.getWorld().getMaxHeight(); y > 0; y--)
    {
        Block block = b.getWorld().getBlockAt(b.getX(), y, b.getZ());
        if(BlockStorage.check(block, "ELEVATOR_PLATE"))
        {
            String floor = ChatColor.translateAlternateColorCodes('&', BlockStorage.getBlockInfo(block, "floor"));
            if(block.getY() == b.getY())
            {
                tellraw.addText((new StringBuilder("&7> ")).append(index).append(". &r").append(floor).append("\n").toString());
                tellraw.addHoverEvent(me.mrCookieSlime.CSCoreLibPlugin.general.Chat.TellRawMessage.HoverAction.SHOW_TEXT, (new StringBuilder(" &e你目前所在的楼层: &r")).append(floor).append("\n").toString());
            } else
            {
                tellraw.addText((new StringBuilder("&7")).append(index).append(". &r").append(floor).append("\n").toString());
                tellraw.addHoverEvent(me.mrCookieSlime.CSCoreLibPlugin.general.Chat.TellRawMessage.HoverAction.SHOW_TEXT, (new StringBuilder(" &e单击传送至此楼层 &r")).append(floor).append("\n").toString());
                tellraw.addClickEvent(me.mrCookieSlime.CSCoreLibPlugin.general.Chat.TellRawMessage.ClickAction.RUN_COMMAND, (new StringBuilder("/sf elevator ")).append(block.getX()).append(" ").append(block.getY()).append(" ").append(block.getZ()).append(" ").toString());
            }
            index++;
        }
    }

    if(index > 2)
        (new CustomBookOverlay("电梯", "粘液科技", new TellRawMessage[] {
            tellraw
        })).open(p);
    else
        Messages.local.sendTranslation(p, "machines.ELEVATOR.no-destinations", true, new Variable[0]);
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:38,代码来源:Elevator.java

示例12: checkChunk

import org.bukkit.block.Block; //导入方法依赖的package包/类
private void checkChunk(ChunkPosition pos, @Nullable Chunk chunk) {
    if(repairedChunks.add(pos)) {
        if(chunk == null) {
            chunk = pos.getChunk(match.getWorld());
        }

        for(BlockState state : chunk.getTileEntities()) {
            if(state instanceof Skull) {
                if(!NMSHacks.isSkullCached((Skull) state)) {
                    Location loc = state.getLocation();
                    broadcastDeveloperWarning("Uncached skull \"" + ((Skull) state).getOwner() + "\" at " + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ());
                }
            }
        }

        // Replace formerly invisible half-iron-door blocks with barriers
        for(Block ironDoor : chunk.getBlocks(Material.IRON_DOOR_BLOCK)) {
            BlockFace half = (ironDoor.getData() & 8) == 0 ? BlockFace.DOWN : BlockFace.UP;
            if(ironDoor.getRelative(half.getOppositeFace()).getType() != Material.IRON_DOOR_BLOCK) {
                ironDoor.setType(Material.BARRIER, false);
            }
        }

        // Remove all block 36 and remember the ones at y=0 so VoidFilter can check them
        for(Block block36 : chunk.getBlocks(Material.PISTON_MOVING_PIECE)) {
            if(block36.getY() == 0) {
                block36Locations.add(block36.getX(), block36.getY(), block36.getZ());
            }
            block36.setType(Material.AIR, false);
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:33,代码来源:WorldProblemMatchModule.java

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

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

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


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