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