org.bukkit.block.Chest#getX ( )源码实例Demo

下面列出了org.bukkit.block.Chest#getX ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: SkyWarsReloaded   文件: GameMap.java
public void addChest(Chest chest, ChestPlacementType cpt) {
	ArrayList<CoordLoc> list;
	if (cpt == ChestPlacementType.NORMAL) {
		list = chests;
	} else {
		list = centerChests;
	}
	InventoryHolder ih = chest.getInventory().getHolder();
       if (ih instanceof DoubleChest) {
       	DoubleChest dc = (DoubleChest) ih;
		Chest left = (Chest) dc.getLeftSide();
		Chest right = (Chest) dc.getRightSide();
		CoordLoc locLeft = new CoordLoc(left.getX(), left.getY(), left.getZ());
		CoordLoc locRight = new CoordLoc(right.getX(), right.getY(), right.getZ());
		if (!(list.contains(locLeft) || list.contains(locRight))) {
			addChest(locLeft, cpt, true);
		}
       } else {
       	CoordLoc loc = new CoordLoc(chest.getX(), chest.getY(), chest.getZ());
           if (!list.contains(loc)){
			addChest(loc, cpt, true);
           }
       }
}
 
源代码2 项目: SkyWarsReloaded   文件: GameMap.java
public void removeChest(Chest chest) {
	InventoryHolder ih = chest.getInventory().getHolder();
	if (ih instanceof DoubleChest) {
		DoubleChest dc = (DoubleChest) ih;
		Chest left = (Chest) dc.getLeftSide();
		Chest right = (Chest) dc.getRightSide();
		CoordLoc locLeft = new CoordLoc(left.getX(), left.getY(), left.getZ());
		CoordLoc locRight = new CoordLoc(right.getX(), right.getY(), right.getZ());
		chests.remove(locLeft);
		centerChests.remove(locLeft);
		chests.remove(locRight);
		centerChests.remove(locLeft);
		saveArenaData();
	} else {
		CoordLoc loc = new CoordLoc(chest.getX(), chest.getY(), chest.getZ());
		chests.remove(loc);
		centerChests.remove(loc);
		saveArenaData();
	}

}
 
源代码3 项目: ShopChest   文件: Shop.java
private Location getHologramLocation(Chest[] chests, BlockFace face) {
    World w = location.getWorld();
    int x = location.getBlockX();
    int y  = location.getBlockY();
    int z = location.getBlockZ();

    Location holoLocation = new Location(w, x, y, z);

    double deltaY = -0.6;

    if (Config.hologramFixedBottom) deltaY = -0.85;

    if (chests[1] != null) {
        Chest c1 = Utils.getMajorVersion() >= 13 && (face == BlockFace.NORTH || face == BlockFace.EAST) ? chests[1] : chests[0];
        Chest c2 = Utils.getMajorVersion() >= 13 && (face == BlockFace.NORTH || face == BlockFace.EAST) ? chests[0] : chests[1];

        if (holoLocation.equals(c1.getLocation())) {
            if (c1.getX() != c2.getX()) {
                holoLocation.add(0, deltaY, 0.5);
            } else if (c1.getZ() != c2.getZ()) {
                holoLocation.add(0.5, deltaY, 0);
            } else {
                holoLocation.add(0.5, deltaY, 0.5);
            }
        } else {
            if (c1.getX() != c2.getX()) {
                holoLocation.add(1, deltaY, 0.5);
            } else if (c1.getZ() != c2.getZ()) {
                holoLocation.add(0.5, deltaY, 1);
            } else {
                holoLocation.add(0.5, deltaY, 0.5);
            }
        }
    } else {
        holoLocation.add(0.5, deltaY, 0.5);
    }

    holoLocation.add(0, Config.hologramLift, 0);

    return holoLocation;
}
 
 方法所在类