本文整理汇总了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) {}
}
}
示例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;
}
}
}
}
示例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;
}
}
}
}
示例4: setTypeAndData
import org.spongepowered.api.entity.Entity; //导入方法依赖的package包/类
@Override
public void setTypeAndData(Entity entity) {
this.spongeType = entity.getType();
updateType(entity, entity.getType());
}