当前位置: 首页>>代码示例>>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;未经允许,请勿转载。