當前位置: 首頁>>代碼示例>>Java>>正文


Java Entity.getLocation方法代碼示例

本文整理匯總了Java中org.spongepowered.api.entity.Entity.getLocation方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.getLocation方法的具體用法?Java Entity.getLocation怎麽用?Java Entity.getLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.spongepowered.api.entity.Entity的用法示例。


在下文中一共展示了Entity.getLocation方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkEntityChange

import org.spongepowered.api.entity.Entity; //導入方法依賴的package包/類
public static void checkEntityChange(Entity entity, boolean newlyCreated) {
    Location<World> loc = entity.getLocation();
    List<Arena> arenas = checkChangeAtLocation(WorldLocationConverter.of(loc));
    for (Arena arena : arenas) {
        try {
            if (newlyCreated) {
                ((InfernoRollbackAgent) ((InfernoArena) arena).getRollbackAgent())
                        .logEntityCreation(entity.getUniqueId());
            } else {
                ((InfernoRollbackAgent) ((InfernoArena) arena).getRollbackAgent())
                        .logEntityChange(entity.createSnapshot());
            }
        } catch (IOException | SQLException ex) {
            throw new RuntimeException("Failed to log entity mutation event for rollback in arena "
                    + arena.getDisplayName(), ex);
        }
    }
}
 
開發者ID:caseif,項目名稱:Inferno,代碼行數:19,代碼來源:InfernoRollbackAgent.java

示例2: CachedEntity

import org.spongepowered.api.entity.Entity; //導入方法依賴的package包/類
public CachedEntity(Entity entity) {
    super(entity);

    this.type = new CachedCatalogType(entity.getType());
    this.uuid = UUID.fromString(entity.getUniqueId().toString());
    this.location = new CachedLocation(entity.getLocation());

    this.rotation = entity.getRotation().clone();
    this.velocity = entity.getVelocity().clone();
    this.scale = entity.getScale().clone();

    if (entity instanceof Carrier) {
        try {
            this.inventory = new CachedInventory(((Carrier) entity).getInventory());
        } catch (AbstractMethodError ignored) {}
    }
}
 
開發者ID:Valandur,項目名稱:Web-API,代碼行數:18,代碼來源:CachedEntity.java

示例3: clickEntity

import org.spongepowered.api.entity.Entity; //導入方法依賴的package包/類
/** return true to cancel the event in the parent */
	static boolean clickEntity(Player source, Entity target, Button side) {
		//try to get shop:
		Location<World> tl = target.getLocation();
		Optional<NPCguard> npc = VillagerShops.getNPCfromLocation(tl);
		
		if (npc.isPresent()) {
//			VillagerShops.l("NPC: " + npc.get().getDisplayName().toPlain());
//			if (side == Button.right) {
				if (npc.get().getPreparator().size()>0) {
					npc.get().updateStock();
					source.openInventory(npc.get().getInventory(source.getUniqueId()));
					VillagerShops.openShops.put(source.getUniqueId(), npc.get().getIdentifier());
				}
//			}
			
			return true;
		}
		return false;
	}
 
開發者ID:DosMike,項目名稱:VillagerShops,代碼行數:21,代碼來源:InteractionHandler.java

示例4: matches

import org.spongepowered.api.entity.Entity; //導入方法依賴的package包/類
@Override
public boolean matches(ScriptEventData data) {
    Entity ent = entity.getInternal();
    Location<World> loc = ent.getLocation();
    World world = loc.getExtent();
    return D2SpongeEventHelper.checkEntityType(ent.getType(), data, this::error)
            && D2SpongeEventHelper.checkWorld(world, data, this::error)
            && D2SpongeEventHelper.checkCuboid((new LocationTag(loc)).getInternal(), data, this::error)
            && D2SpongeEventHelper.checkWeather(Utilities.getIdWithoutDefaultPrefix(
                    world.getWeather().getId()), data, this::error);
}
 
開發者ID:DenizenScript,項目名稱:Denizen2Sponge,代碼行數:12,代碼來源:EntityMovesScriptEvent.java

示例5: matches

import org.spongepowered.api.entity.Entity; //導入方法依賴的package包/類
@Override
public boolean matches(ScriptEvent.ScriptEventData data) {
    Entity ent = entity.getInternal();
    Location<World> loc = ent.getLocation();
    World world = loc.getExtent();
    return D2SpongeEventHelper.checkEntityType(ent.getType(), data, this::error)
            && D2SpongeEventHelper.checkWorld(world, data, this::error)
            && D2SpongeEventHelper.checkCuboid((new LocationTag(loc)).getInternal(), data, this::error)
            && D2SpongeEventHelper.checkWeather(Utilities.getIdWithoutDefaultPrefix(
                    world.getWeather().getId()), data, this::error);
}
 
開發者ID:DenizenScript,項目名稱:Denizen2Sponge,代碼行數:12,代碼來源:EntitySpawnsScriptEvent.java

示例6: matches

import org.spongepowered.api.entity.Entity; //導入方法依賴的package包/類
@Override
public boolean matches(ScriptEventData data) {
    Entity ent = ((EntityTag) entities.getInternal().get(0)).getInternal();
    Location<World> loc = ent.getLocation();
    World world = loc.getExtent();
    return D2SpongeEventHelper.checkEntityType(ent.getType(), data, this::error, "type")
            && D2SpongeEventHelper.checkWorld(world, data, this::error)
            && D2SpongeEventHelper.checkCuboid(new LocationTag(loc).getInternal(), data, this::error)
            && D2SpongeEventHelper.checkWeather(Utilities.getIdWithoutDefaultPrefix(
                    world.getWeather().getId()), data, this::error);
}
 
開發者ID:DenizenScript,項目名稱:Denizen2Sponge,代碼行數:12,代碼來源:EntityCollidesWithEntityScriptEvent.java


注:本文中的org.spongepowered.api.entity.Entity.getLocation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。