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


Java Rotation类代码示例

本文整理汇总了Java中org.bukkit.Rotation的典型用法代码示例。如果您正苦于以下问题:Java Rotation类的具体用法?Java Rotation怎么用?Java Rotation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setRotation

import org.bukkit.Rotation; //导入依赖的package包/类
public void setRotation(Rotation rotation) throws IllegalArgumentException {
    switch (rotation) {
        case CLOCKWISE:
            getHandle().setItemRotation(0);
            break;
        case COUNTER_CLOCKWISE:
            getHandle().setItemRotation(1);
            break;
        case FLIPPED:
            getHandle().setItemRotation(2);
            break;
        case NONE:
            getHandle().setItemRotation(3);
            break;
    }
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:17,代码来源:CanaryItemFrame.java

示例2: toBukkitRotation

import org.bukkit.Rotation; //导入依赖的package包/类
Rotation toBukkitRotation(int value) {
    // Translate NMS rotation integer to Bukkit API
    switch (value) {
    case 0:
        return Rotation.NONE;
    case 1:
        return Rotation.CLOCKWISE_45;
    case 2:
        return Rotation.CLOCKWISE;
    case 3:
        return Rotation.CLOCKWISE_135;
    case 4:
        return Rotation.FLIPPED;
    case 5:
        return Rotation.FLIPPED_45;
    case 6:
        return Rotation.COUNTER_CLOCKWISE;
    case 7:
        return Rotation.COUNTER_CLOCKWISE_45;
    default:
        throw new AssertionError("Unknown rotation " + value + " for " + getHandle());
    }
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:24,代码来源:CraftItemFrame.java

示例3: toInteger

import org.bukkit.Rotation; //导入依赖的package包/类
static int toInteger(Rotation rotation) {
    // Translate Bukkit API rotation to NMS integer
    switch (rotation) {
    case NONE:
        return 0;
    case CLOCKWISE_45:
        return 1;
    case CLOCKWISE:
        return 2;
    case CLOCKWISE_135:
        return 3;
    case FLIPPED:
        return 4;
    case FLIPPED_45:
        return 5;
    case COUNTER_CLOCKWISE:
        return 6;
    case COUNTER_CLOCKWISE_45:
        return 7;
    default:
        throw new IllegalArgumentException(rotation + " is not applicable to an ItemFrame");
    }
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:24,代码来源:CraftItemFrame.java

示例4: toBukkitRotation

import org.bukkit.Rotation; //导入依赖的package包/类
Rotation toBukkitRotation(int value) {
    // Translate NMS rotation integer to Bukkit API
    switch (value) {
    case 0:
        return Rotation.NONE;
    case 1:
        return Rotation.CLOCKWISE;
    case 2:
        return Rotation.FLIPPED;
    case 3:
        return Rotation.COUNTER_CLOCKWISE;
    default:
        throw new AssertionError("Unknown rotation " + value + " for " + getHandle());
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:16,代码来源:CraftItemFrame.java

示例5: toInteger

import org.bukkit.Rotation; //导入依赖的package包/类
static int toInteger(Rotation rotation) {
    // Translate Bukkit API rotation to NMS integer
    switch (rotation) {
    case NONE:
        return 0;
    case CLOCKWISE:
        return 1;
    case FLIPPED:
        return 2;
    case COUNTER_CLOCKWISE:
        return 3;
    default:
        throw new IllegalArgumentException(rotation + " is not applicable to an ItemFrame");
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:16,代码来源:CraftItemFrame.java

示例6: onEntityInteractEntity

import org.bukkit.Rotation; //导入依赖的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

示例7: onLoad

import org.bukkit.Rotation; //导入依赖的package包/类
@Override
public void onLoad() {
    add(Rotation.NONE, "None", "0", "360", "North", "Up");
    add(Rotation.CLOCKWISE_45, "Clockwise 45", "45", "-315", "North East", "Up Right");
    add(Rotation.CLOCKWISE, "Clockwise", "90", "-270", "East", "Right");
    add(Rotation.CLOCKWISE_135, "Clockwise 135", "135", "-225", "South East", "Down Right");
    add(Rotation.FLIPPED, "Flipped", "180", "-180", "South", "Down");
    add(Rotation.FLIPPED_45, "Flipped 45", "225", "-135", "South West", "Down Left");
    add(Rotation.COUNTER_CLOCKWISE, "Counter Clockwise", "270", "-90", "West", "Left");
    add(Rotation.COUNTER_CLOCKWISE_45, "Counter Clockwise 45", "315", "-45", "North West", "Up Left");
}
 
开发者ID:GameBoxx,项目名称:GameBoxx,代码行数:12,代码来源:Rotations.java

示例8: get

import org.bukkit.Rotation; //导入依赖的package包/类
@Override
@Nullable
protected Rotation[] get(Event e) {
	if (entity != null) {
		if (entity.getSingle(e) instanceof ItemFrame) {
			return new Rotation[]{((ItemFrame)entity.getSingle(e)).getRotation()};
		}
	}
	return null;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:11,代码来源:ExprItemframeRotation.java

示例9: change

import org.bukkit.Rotation; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	if (mode == ChangeMode.SET) {
		if (entity != null) {
			if (entity.getSingle(e) instanceof ItemFrame) {
				((ItemFrame)entity.getSingle(e)).setRotation((Rotation)delta[0]);
			}
		}
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:11,代码来源:ExprItemframeRotation.java

示例10: acceptChange

import org.bukkit.Rotation; //导入依赖的package包/类
@Override
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
	if (mode == ChangeMode.SET) {
		return CollectionUtils.array(Rotation.class);
	}
	return null;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:8,代码来源:ExprItemframeRotation.java

示例11: attachItemFrame

import org.bukkit.Rotation; //导入依赖的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

示例12: getRotation

import org.bukkit.Rotation; //导入依赖的package包/类
public Rotation getRotation() {
    if (getHandle().getItemRotation() == 0) {
        return Rotation.NONE;
    } else if (getHandle().getItemRotation() == 1) {
        return Rotation.CLOCKWISE;
    } else if (getHandle().getItemRotation() == 2) {
        return Rotation.FLIPPED;
    } else {
        return Rotation.COUNTER_CLOCKWISE;
    }
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:12,代码来源:CanaryItemFrame.java

示例13: find

import org.bukkit.Rotation; //导入依赖的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

示例14: loadItemFrame

import org.bukkit.Rotation; //导入依赖的package包/类
public static EntityData loadItemFrame(Vector location, ItemStack item, BlockFace direction, Rotation rotation) {
    EntityData data = new EntityData(EntityType.ITEM_FRAME);
    data.facing = direction;
    data.relativeLocation = location.clone();
    data.rotation = rotation;
    data.item = item;
    return data;
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:9,代码来源:EntityData.java

示例15: execute

import org.bukkit.Rotation; //导入依赖的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


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