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


Java Entity.getType方法代碼示例

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


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

示例1: 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

示例2: onSpawnExp

import org.spongepowered.api.entity.Entity; //導入方法依賴的package包/類
@Listener
public void onSpawnExp(final SpawnEntityEvent event, @First Player player) {
    if (this.stopThem.contains(player.getUniqueId())) {
        for (Entity e : event.getEntities()) {
            if (e.getType() == EntityTypes.EXPERIENCE_ORB) {
                event.setCancelled(true);
                return;
            }
        }
    }
}
 
開發者ID:ichorpowered,項目名稱:latch,代碼行數:12,代碼來源:InteractBlockListener.java

示例3: onDamageEntity

import org.spongepowered.api.entity.Entity; //導入方法依賴的package包/類
@Listener
	public void onDamageEntity(DamageEntityEvent event, @First EntityDamageSource source) {
//		Optional<IndirectEntityDamageSource> secondSource = event.getCause().first(IndirectEntityDamageSource.class);
		ConfigurationNode node = PlayerList.getInstance().getNode();
		Entity entityTarget = event.getTargetEntity();
		if (source.getSource().getType() == EntityTypes.PLAYER || (source.getSource().getType() == EntityTypes.ARROW
			&& event.getCause().first(IndirectEntityDamageSource.class).get().getIndirectSource().getType() == EntityTypes.PLAYER)) {
				Player cause = null;
				if (source.getSource().getType() == EntityTypes.PLAYER) {
					cause = (Player) source.getSource();
				} else {
					cause = (Player) event.getCause().first(IndirectEntityDamageSource.class).get().getIndirectSource();
				}
				if (!node.getNode("players", cause.getUniqueId(), "pvp").getBoolean()) {
					if (entityTarget.getType() == EntityTypes.PLAYER) {
						event.setCancelled(true);
						cause.sendMessage(TranslationHelper.t("text.player.attacker", cause.getLocale()));
						cause.sendMessage(TranslationHelper.t("text.player.toggle", cause.getLocale()));
						return;
					}
				} else if (entityTarget.getType() == EntityTypes.PLAYER) {
					Player target = (Player) entityTarget;
					if (!node.getNode("players", target.getUniqueId(), "pvp").getBoolean()) {
						event.setCancelled(true);
						cause.sendMessage(TranslationHelper.t("text.player.target", cause.getLocale()));
						target.sendMessage(TranslationHelper.t("text.player.attacked", cause.getLocale()));
						return;
					}
				}
		}
	}
 
開發者ID:TehTotalPwnage,項目名稱:PvPToggle,代碼行數:32,代碼來源:PvPListener.java

示例4: setTypeAndData

import org.spongepowered.api.entity.Entity; //導入方法依賴的package包/類
@Override
public void setTypeAndData(Entity entity) {
    this.spongeType = entity.getType();

    updateType(entity, entity.getType());
}
 
開發者ID:Guichaguri,項目名稱:PacketControl,代碼行數:7,代碼來源:MixinPacketSpawnObject.java


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