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


Java ItemFrame.setRotation方法代码示例

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


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

示例1: onEntityInteractEntity

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
@EventHandler
public void onEntityInteractEntity(PlayerInteractEntityEvent event) {
	if (event.getRightClicked().getType() == EntityType.ITEM_FRAME) {
		event.setCancelled(true);
		ItemFrame frame = (ItemFrame) event.getRightClicked();
		frame.setRotation(Rotation.NONE);
	}
	
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:10,代码来源:GeneralEvents.java

示例2: attachItemFrame

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
public static void attachItemFrame(Block block, ItemStack map, BlockFace face) {
    ItemFrame frame = block.getWorld().spawn(block.getRelative(face).getLocation(), ItemFrame.class);
    Block frameBlock = block.getRelative(face);
    frameBlock.setType(Material.AIR);
    frame.teleport(frameBlock.getLocation());
    frame.setFacingDirection(face, true);
    frame.setItem(map);
    frame.setRotation(Rotation.NONE);
}
 
开发者ID:leMaik,项目名称:RpgPlus,代码行数:10,代码来源:Util.java

示例3: find

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
private ItemFrame[][] find(Location pos1, Location pos2, BlockFace facing) {
    try {
        Location distance = pos2.clone().subtract(pos1).add(1, 1, 1);
        int width = Math.max(distance.getBlockX(), distance.getBlockZ());
        ItemFrame[][] frames = new ItemFrame[width][distance.getBlockY()];

        World world = pos1.getWorld();

        this.reverse = (facing == BlockFace.NORTH || facing == BlockFace.EAST);
        int v = 0;
        for (double y = pos1.getY(); y <= pos2.getY(); y++, v++) {
            int h = 0;
            for (double z = pos1.getZ(); z <= pos2.getZ(); z++) {
                for (double x = pos1.getX(); x <= pos2.getX(); x++, h++) {
                    Location pos = new Location(world, x, y, z);
                    Collection<Entity> entities = world.getNearbyEntities(pos, 0.1, 0.1, 0.1);
                    boolean contains = false;
                    for (Entity ent : entities) {
                        if (ent instanceof ItemFrame && ((ItemFrame) ent).getFacing() == facing) {
                            ItemFrame itemFrame = (ItemFrame) ent;
                            itemFrame.setRotation(Rotation.NONE);
                            contains = true;
                            frames[reverse ? width - 1 - h : h][v] = (ItemFrame) ent;
                            break;
                        }
                    }
                    if (!contains) return null;
                }
            }
        }
        return frames;
    } catch (Throwable e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:37,代码来源:BukkitImageViewer.java

示例4: onFrameDestroy

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
@EventHandler
public void onFrameDestroy(FrameDestroyEvent e){
	if(e.getAction().equals(FrameAction.LeftClick)){
		e.setCancelled(true);
		ItemFrame frame = e.getItemFrame();
		frame.setRotation(frame.getRotation().rotateCounterClockwise());
	}
}
 
开发者ID:iZenith,项目名称:IZenith-Main,代码行数:9,代码来源:FrameListener.java

示例5: onEntityDamageByEntity

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
	if (e.getEntityType().equals(EntityType.ITEM_FRAME)) {
		ItemFrame itemFrame = (ItemFrame) e.getEntity();
		if (e.getDamager() instanceof Player) {
			Player player = (Player) e.getDamager();
			if(player.isSneaking()){
				itemFrame.setRotation(itemFrame.getRotation().rotateCounterClockwise());
				e.setCancelled(true);
			}
		}
	}
}
 
开发者ID:iZenith,项目名称:IZenith-Main,代码行数:14,代码来源:FrameListener.java

示例6: execute

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
@Override
public void execute(BlockPlacer blockPlacer, BlockLoger loger) {
    Chunk chunk = m_location.getChunk();
    if (!chunk.isLoaded()) {
        if (!chunk.load()) {
            return;
        }
    }

    World w = m_location.getWorld();
    Block block = w.getBlockAt(m_location);
    Material material = block.getType();
    if (!isSolid(material)) {
        m_oldMaterial = material;
        block.setType(Material.BARRIER);
    } else {
        m_oldMaterial = null;
    }

    m_frame = (ItemFrame) w.spawn(block.getRelative(m_rotation).getLocation(), ItemFrame.class);
    m_frame.setFacingDirection(m_rotation, true);
    m_frame.setRotation(Rotation.NONE);

    m_mapView = Bukkit.createMap(w);
    m_mapHelper.storeMap(m_mapView, m_img);
    m_mapHelper.drawImage(m_mapView, m_img);
    m_frame.setItem(new ItemStack(Material.MAP, 1, m_mapView.getId()));
}
 
开发者ID:SBPrime,项目名称:MCPainter,代码行数:29,代码来源:HdImageCommand.java

示例7: rotate

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
private void rotate() {
	Craftomat.debug("rotate", "Called! ("+Craftomat.DELAY_BETWEEN_ROTATIONS.toTicks() + ", " +(System.currentTimeMillis() - this.rotationStart) + ", " + this.isRotating + ")");

	if (!this.isRotating) {
		if (this.rotationTask != null && this.rotationTask.isEnabled()) { this.rotationTask.disable(); }
		Craftomat.debug("rotate", "Method still called even though craftomat has finished rotation?!");
		return;
	}

	// Check if the craftomat is still valid
	if (!this.isValid()) { this.finish(); return; }
	final ItemFrame frame = this.getItemFrame().get();

	// Check if the item is still in the frame
	final ItemStack itemStack = frame.getItem();
	if (itemStack == null || itemStack.getType().equals(Material.AIR)) { this.finish(); return; }

	// Rotate the itemframe
	switch (frame.getRotation()) {
		case NONE: frame.setRotation(Rotation.CLOCKWISE_45); break;
		case CLOCKWISE_45: frame.setRotation(Rotation.CLOCKWISE); break;
		case CLOCKWISE: frame.setRotation(Rotation.CLOCKWISE_135); break;
		case CLOCKWISE_135: frame.setRotation(Rotation.FLIPPED); break;
		case FLIPPED: frame.setRotation(Rotation.FLIPPED_45); break;
		case FLIPPED_45: frame.setRotation(Rotation.COUNTER_CLOCKWISE); break;
		case COUNTER_CLOCKWISE: frame.setRotation(Rotation.COUNTER_CLOCKWISE_45); break;
		case COUNTER_CLOCKWISE_45: frame.setRotation(Rotation.NONE); break;
		default: CraftoMessenger.warnStaff("Got unknown itemframe rotation '" + frame.getRotation() + "' in Craftomat#rotate()!"); break;
	}

	// Update the sign
	final Sign sign = this.getSign().get();
	if (sign.getLine(0).length() < 1) {
		sign.setLine(0, ChatColor.BOLD + "#");
		sign.setLine(3, ChatColor.BOLD + "#");
	}
	else {
		sign.setLine(0, sign.getLine(0) + "#");
		sign.setLine(3, sign.getLine(3) + "#");
	}
	sign.update(true, false);

	// Play sound
	frame.getLocation().getWorld().playSound(frame.getLocation(), Sound.BLOCK_WOOD_BUTTON_CLICK_ON, 0.75f, 0.4f);

	// Check if this is the last run
	if (System.currentTimeMillis() - this.rotationStart > Craftomat.COMPLETE_ROTATION_DURATION.toMillis()) {
		this.finish();
	}
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:51,代码来源:Craftomat.java

示例8: applyToEntity

import org.bukkit.entity.ItemFrame; //导入方法依赖的package包/类
private boolean applyToEntity(Entity entity) {

        entity.teleport(_location);

        if (entity instanceof Directional && _facing != null) {

            Directional directional = (Directional)entity;
            directional.setFacingDirection(_facing);
        }

        if (entity instanceof Painting && _art != null) {
            Painting painting = (Painting)entity;

            painting.setArt(_art);
        }

        if (entity instanceof ItemFrame && _frameItem != null) {
            ItemFrame frame = (ItemFrame)entity;

            frame.setItem(_frameItem);
            frame.setRotation(_frameRotation);
        }

        if (entity instanceof ArmorStand && _hasArmorStand) {
            ArmorStand stand = (ArmorStand)entity;

            stand.setItemInHand(_itemInHand);
            stand.setHelmet(_helmet);
            stand.setChestplate(_chestplate);
            stand.setLeggings(_leggings);
            stand.setBoots(_boots);
            stand.setHeadPose(_headPose);
            stand.setBodyPose(_bodyPose);
            stand.setLeftArmPose(_leftArmPose);
            stand.setRightArmPose(_rightArmPose);
            stand.setLeftLegPose(_leftLegPose);
            stand.setRightLegPose(_rightLegPose);
            stand.setBasePlate(_hasArmorBasePlate);
            stand.setGravity(_hasArmorGravity);
            stand.setVisible(_isArmorVisible);
            stand.setArms(_hasArmorArms);
            stand.setSmall(_isArmorSmall);
        }

        if (_facing == null)
            return false;

        return true;
    }
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:50,代码来源:SerializableFurnitureEntity.java


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