net.minecraft.entity.Entity.getUniqueID()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中net.minecraft.entity.Entity.getUniqueID()方法的一些代码示例,展示了Entity.getUniqueID()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getUniqueID()方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:getUniqueID

Entity.getUniqueID介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public ItemStack apply(@Nonnull ItemStack stack, @Nonnull Random rand, @Nonnull LootContext context) {
  if (context.getKillerPlayer() != null) {
    ((ItemRelic) ModItems.dice).bindToUUID(context.getKillerPlayer().getUniqueID(), stack);
  }
  return stack;
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

public QuestStack(IQuest quest, Entity giver) {
  this.quest = quest;
  if (giver != null) {
    this.giverUniqueID = giver.getUniqueID();
  }
  this.giver = giver;
}

代码示例来源:origin: Lunatrius/Schematica

@Override
public void addEntity(final Entity entity) {
  if (entity == null || entity.getUniqueID() == null || entity instanceof EntityPlayer) {
    return;
  }
  for (final Entity e : this.entities) {
    if (entity.getUniqueID().equals(e.getUniqueID())) {
      return;
    }
  }
  this.entities.add(entity);
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

public boolean isGiver(Entity entity) {
  if (giver != null && giver == entity) {
    return true;
  }
  return giverUniqueID != null && entity.getUniqueID().equals(giverUniqueID);
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

public DinosaurEntity get(DinosaurEntity owner) {
  for (Entity entity : owner.world.loadedEntityList) {
    if (entity instanceof DinosaurEntity && entity.getUniqueID().equals(this.entity)) {
      return (DinosaurEntity) entity;
    }
  }
  return null;
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

private DinosaurEntity get(World world, UUID uuid) {
  for (Entity entity : world.loadedEntityList) {
    if (entity instanceof DinosaurEntity && entity.getUniqueID().equals(uuid)) {
      return (DinosaurEntity) entity;
    }
  }
  return null;
}

代码示例来源:origin: TeamWizardry/Wizardry

public static boolean addModifier(Entity entity, ResourceLocation loc, ModifierPredicate<SpellRing, SpellData> predicate)
{
  HashMap<ResourceLocation, ModifierPredicate<SpellRing, SpellData>> predicates = entityModifiers.get(entity.getUniqueID());
  if (predicates == null) predicates = new HashMap<>();
  
  predicates.put(loc, predicate);
  entityModifiers.put(entity.getUniqueID(), predicates);
  
  return false;
}

代码示例来源:origin: TeamWizardry/Wizardry

public static boolean removeModifier(Entity entity, ResourceLocation loc)
{
  HashMap<ResourceLocation, ModifierPredicate<SpellRing, SpellData>> predicates = entityModifiers.get(entity.getUniqueID());
  if (predicates == null) return false;
  return predicates.remove(loc) != null;
}

代码示例来源:origin: Lunatrius/Schematica

@Override
public void removeEntity(final Entity entity) {
  if (entity == null || entity.getUniqueID() == null) {
    return;
  }
  final Iterator<Entity> iterator = this.entities.iterator();
  while (iterator.hasNext()) {
    final Entity e = iterator.next();
    if (entity.getUniqueID().equals(e.getUniqueID())) {
      iterator.remove();
    }
  }
}

代码示例来源:origin: CyclopsMC/IntegratedDynamics

protected ValueEntity(@Nullable Entity value) {
  super(ValueTypes.OBJECT_ENTITY);
  this.value = value == null ? Optional.<UUID>absent() : Optional.of(value.getUniqueID());
}

代码示例来源:origin: Vazkii/Quark

@SideOnly(Side.CLIENT)
public static ResourceLocation getRandomTexture(Entity e, RandomTextureType type, boolean choose) {
  List<ResourceLocation> styles = textures.get(type);
  if(!choose)
    return styles.get(styles.size() - 1);
  
  UUID id = e.getUniqueID();
  int choice = Math.abs((int) (id.getMostSignificantBits() % styles.size()));
  return styles.get(choice);
}

代码示例来源:origin: TeamWizardry/Wizardry

public static List<AttributeModifier> compileModifiers(Entity entity, SpellRing spell, SpellData data)
  {
    List<AttributeModifier> modifiers = new LinkedList<>();
    HashMap<ResourceLocation, ModifierPredicate<SpellRing, SpellData>> predicates = entityModifiers.get(entity.getUniqueID());
    if (predicates == null)
      return modifiers;
    
    for (ModifierPredicate<SpellRing, SpellData> predicate : predicates.values())
      modifiers.addAll(predicate.apply(spell, data));
    return modifiers;
  }
}

代码示例来源:origin: SquidDev-CC/plethora

EntityReference(T entity) {
  this.server = entity.getServer();
  this.id = entity.getUniqueID();
  this.entity = new WeakReference<>(entity);
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

private Relationship getRelationship(Entity entity, boolean create) {
  for (Relationship relationship : this.relationships) {
    if (relationship.getUUID().equals(entity.getUniqueID())) {
      return relationship;
    }
  }
  if (create) {
    Relationship relationship = new Relationship(entity.getUniqueID(), (short) 0);
    this.relationships.add(relationship);
    return relationship;
  }
  return null;
}

代码示例来源:origin: SquidDev-CC/plethora

@Nullable
private static Entity findEntityByUUID(IWorldLocation location, UUID uuid) {
  List<Entity> entities = location.getWorld().getEntitiesWithinAABB(Entity.class, getBox(location.getPos()),
    entity -> DEFAULT_PREDICATE.apply(entity) && entity.getUniqueID().equals(uuid));
  return entities.size() > 0 ? entities.get(0) : null;
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

public boolean isOwnerOrSameTeamOrFriend(@Nullable Entity entity) {
  if (entity instanceof IOwnable) {
    Owner owner = ((IOwnable) entity).getOwner();
    return isOwnerOrSameTeamOrFriend(entity.world, owner.getUUID(), owner.getName());
  }
  return entity != null && isOwnerOrSameTeamOrFriend(entity.world, entity.getUniqueID(), entity.getName());
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

public static boolean shouldEffectEntity(World world, Entity entity, MissileBase missile) {
  if (!AWVehicleStatics.allowFriendlyFire && missile.shooterLiving instanceof NpcBase) {
    @Nonnull NpcBase npc = ((NpcBase) missile.shooterLiving);
    if (entity instanceof NpcBase) {
      Owner targetNpcOwner = ((NpcBase) entity).getOwner();
      return !npc.getOwner().isOwnerOrSameTeamOrFriend(world, targetNpcOwner.getUUID(), targetNpcOwner.getName());
    } else if (entity instanceof EntityPlayer) {
      return !npc.getOwner().isOwnerOrSameTeamOrFriend(world, entity.getUniqueID(), entity.getName());
    }
  }
  return true;
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

public void onDeath(DamageSource cause) {
  if (this.getHive() != null) {
    Entity entity = cause.getTrueSource();
    if (entity != null) {
      this.getHive().setWorld(this.world);
      this.getHive().modifyPlayerReputation(entity.getUniqueID(), -15);
    }
  }
  super.onDeath(cause);
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

public void onDeath(DamageSource cause) {
  if (cause.getTrueSource() != null && cause.getTrueSource() instanceof EntityLivingBase && !world.isRemote) {
    this.setVictorId(cause.getTrueSource().getUniqueID());
    if (this.flock != null) {
      this.flock.setFearTarget((EntityLivingBase) cause.getTrueSource());
    }
  }
  super.onDeath(cause);
}

代码示例来源:origin: sinkillerj/ProjectE

@SubscribeEvent
public static void onConstruct(EntityEvent.EntityConstructing evt)
{
  if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER // No world to check yet
    && evt.getEntity() instanceof EntityPlayer && !(evt.getEntity() instanceof FakePlayer))
  {
    TransmutationOffline.clear(evt.getEntity().getUniqueID());
    PECore.debugLog("Clearing offline data cache in preparation to load online data");
  }
}

相关文章

微信公众号

最新文章

更多

Entity类方法