本文整理匯總了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);
}
}
}
示例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) {}
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}