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


Java ItemFrame.getFacing方法代码示例

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


在下文中一共展示了ItemFrame.getFacing方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addFrame

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
public Frame addFrame(String pictureURL, ItemFrame entity) {
	Frame frame = new Frame(this.getNewFrameID(), pictureURL, entity.getLocation(), entity.getFacing());
	frame.setEntity(entity);
	
	if (frame.getBufferImage() == null) {
		return null;
	}
	
	Chunk chunk = entity.getLocation().getChunk();
	List<Frame> frameList = this.getFramesInChunk(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
	frameList.add(frame);
	this.setFramesInChunk(chunk.getWorld().getName(), chunk.getX(), chunk.getZ(), frameList);
	
	Utils.setFrameItemWithoutSending(entity, new ItemStack(Material.AIR));
	this.sendFrame(frame);
	this.saveFrames();
	return frame;
}
 
开发者ID:Howaner,项目名称:FramePicture,代码行数:19,代码来源:FrameManager.java

示例2: addMultiFrames

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
public List<Frame> addMultiFrames(BufferedImage img, ItemFrame[] frames, int vertical, int horizontal) {
	if (frames.length == 0 || horizontal <= 0) return null;
	img = Utils.scaleImage(img, img.getWidth() * vertical, img.getHeight() * horizontal);
	
	int width = img.getWidth() / vertical;
	int height = img.getHeight() / horizontal;
	
	List<Frame> frameList = new ArrayList<Frame>();
	int globalId = this.getNewFrameID();
	int id = globalId;
	//y = Horizontal
	for (int y = 0; y < horizontal; y++) {
		//x = Vertical
		for (int x = 0; x < vertical; x++) {
			BufferedImage frameImg = Utils.cutImage(img, x * width, y * height, width, height);
			frameImg = Utils.scaleImage(frameImg, 128, 128, false);
			File file = this.pictureDB.writeImage(frameImg, String.format("Frame%s_%s-%s", globalId, x, y));
			
			ItemFrame entity = frames[vertical * y + x];
			Utils.setFrameItemWithoutSending(entity, new ItemStack(Material.AIR));
			Frame frame = this.getFrame(entity);
			if (frame != null)
				this.removeFrame(frame);
			
			frame = new Frame(globalId, file.getName(), entity.getLocation(), entity.getFacing());
			frame.setEntity(entity);
			
			Chunk chunk = frame.getLocation().getChunk();
			List<Frame> chunkFrames = this.getFramesInChunk(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
			chunkFrames.add(frame);
			this.setFramesInChunk(chunk.getWorld().getName(), chunk.getX(), chunk.getZ(), chunkFrames);
			
			globalId++;
			frameList.add(frame);
			this.sendFrame(frame);
		}
	}
	
	this.saveFrames();
	return frameList;
}
 
开发者ID:Howaner,项目名称:FramePicture,代码行数:42,代码来源:FrameManager.java

示例3: getItemFrameFromChunk

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
public static ItemFrame getItemFrameFromChunk(Chunk chunk, Location loc, BlockFace face) {
	for (Entity entity : chunk.getEntities()) {
		if ((entity.getType() == EntityType.ITEM_FRAME) && isSameLocation(entity.getLocation(), loc)) {
			ItemFrame frameEntity = (ItemFrame)entity;
			if ((face == null) || (frameEntity.getFacing() == face)) {
				return frameEntity;
			}
		}
	}
	return null;
}
 
开发者ID:Howaner,项目名称:FramePicture,代码行数:12,代码来源:Utils.java

示例4: selectFrame

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
public void selectFrame(ItemFrame start) {
    Location pos1 = start.getLocation().clone();
    Location pos2 = start.getLocation().clone();

    BlockFace facing = start.getFacing();
    int planeX = facing.getModX() == 0 ? 1 : 0;
    int planeY = facing.getModY() == 0 ? 1 : 0;
    int planeZ = facing.getModZ() == 0 ? 1 : 0;

    ItemFrame[][] res = find(pos1, pos2, facing);
    Location tmp;
    while (true) {
        if (res != null) {
            frames = res;
        }
        tmp = pos1.clone().subtract(planeX, planeY, planeZ);
        if ((res = find(tmp, pos2, facing)) != null) {
            pos1 = tmp;
            continue;
        }
        tmp = pos2.clone().add(planeX, planeY, planeZ);
        if ((res = find(pos1, tmp, facing)) != null) {
            pos2 = tmp;
            continue;
        }
        tmp = pos1.clone().subtract(planeX, 0, planeZ);
        if ((res = find(tmp, pos2, facing)) != null) {
            pos1 = tmp;
            continue;
        }
        tmp = pos2.clone().add(planeX, 0, planeZ);
        if ((res = find(pos1, tmp, facing)) != null) {
            pos2 = tmp;
            continue;
        }
        tmp = pos1.clone().subtract(0, 1, 0);
        if ((res = find(tmp, pos2, facing)) != null) {
            pos1 = tmp;
            continue;
        }
        tmp = pos2.clone().add(0, 1, 0);
        if ((res = find(pos1, tmp, facing)) != null) {
            pos2 = tmp;
            continue;
        }
        break;
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:49,代码来源:BukkitImageViewer.java


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