Package de.kumpelblase2.remoteentities.persistence

Examples of de.kumpelblase2.remoteentities.persistence.EntityData


      @Override
      public void onPathfindEnd(Pathfinder inFinder, PathResult inResult)
      {
        if(inResult == PathResult.SUCCESS)
        {
          RemoteAsyncPathFindEvent event = new RemoteAsyncPathFindEvent(Pathfinder.this.m_entity, inFinder.getLastPath(), true);
          Bukkit.getPluginManager().callEvent(event);
          if(event.isCancelled())
            return;

          Pathfinder.this.m_currentPath = event.getPath();
          Pathfinder.this.m_currentPath.setCustomSpeed(inSpeed);
          NMSUtil.getNavigation(Pathfinder.this.m_entity.getHandle()).a(Pathfinder.this.m_currentPath.toNMSPath(), inSpeed);
        }
      }
    });
View Full Code Here


  {
    try
    {
      Constructor<? extends RemoteEntity> constructor = inType.getRemoteClass().getConstructor(int.class, EntityManager.class);
      RemoteEntity entity = constructor.newInstance(inID, this);
      RemoteEntityCreateEvent event = new RemoteEntityCreateEvent(entity);
      Bukkit.getPluginManager().callEvent(event);
      if(event.isCancelled())
        return null;

      this.m_entities.put(inID, entity);
      return entity;
    }
View Full Code Here

  {
    try
    {
      Constructor<? extends RemoteEntity> constructor = inType.getRemoteClass().getConstructor(int.class, String.class, EntityManager.class);
      RemoteEntity entity = constructor.newInstance(inID, inName, this);
      RemoteEntityCreateEvent event = new RemoteEntityCreateEvent(entity);
      Bukkit.getPluginManager().callEvent(event);
      if(event.isCancelled())
        return null;

      this.m_entities.put(inID, entity);
      return entity;
    }
View Full Code Here

  public void spawn(Location inLocation)
  {
    if(this.isSpawned())
      return;

    RemoteEntitySpawnEvent event = new RemoteEntitySpawnEvent(this, inLocation);
    Bukkit.getPluginManager().callEvent(event);
    if(event.isCancelled())
      return;

    inLocation = event.getSpawnLocation();
    WorldServer worldServer = ((CraftWorld)inLocation.getWorld()).getHandle();
    UUID uuid = UUID.nameUUIDFromBytes(("NPC:" + this.getID() + this.getName()).getBytes(Charsets.UTF_8));
    GameProfile profile = new GameProfile(uuid.toString().replaceAll("-", ""), this.getName());
    this.m_entity = new RemotePlayerEntity(worldServer.getMinecraftServer(), worldServer, profile, new PlayerInteractManager(worldServer), this);
    worldServer.addEntity(m_entity);
View Full Code Here

    this.cancelPath(CancelReason.PLUGIN);
  }

  public void cancelPath(CancelReason inReason)
  {
    RemotePathCancelEvent event = new RemotePathCancelEvent(this.m_entity, inReason);
    Bukkit.getPluginManager().callEvent(event);
    this.m_currentPath = null;
  }
View Full Code Here

    }

    List<FeatureData> featureList = new ArrayList<FeatureData>();
    for(int i = 0; i < inEntity.getFeatures().getAllFeatures().size(); i++)
    {
      Feature f = inEntity.getFeatures().getAllFeatures().get(i);
      if(!f.getClass().isAnnotationPresent(IgnoreSerialization.class))
        featureList.add(new FeatureData(f));
    }

    this.features = featureList.toArray(new FeatureData[featureList.size()]);
  }
View Full Code Here

  @Override
  public boolean shouldExecute()
  {
    if(this.getRemoteEntity().getFeatures().hasFeature(MateFeature.class))
    {
      MateFeature feature = this.getRemoteEntity().getFeatures().getFeature(MateFeature.class);
      if(!feature.isAffected())
        return false;
      else
      {
        this.m_mate = this.getNextAnimal();
        return this.m_mate != null;
View Full Code Here

    {
      EntityLiving mate = (EntityLiving)it.next();
      double currentRange;
      if(this.getRemoteEntity().getFeatures().hasFeature(MateFeature.class))
      {
        MateFeature feature = this.getRemoteEntity().getFeatures().getFeature(MateFeature.class);
        if(feature.isPossiblePartner((LivingEntity)mate.getBukkitEntity()) && (currentRange = entity.e(mate)) < nearestRange)
        {
          nearest = mate;
          nearestRange = currentRange;
        }
      }
View Full Code Here

  protected EntityLiving createChild()
  {
    LivingEntity baby = null;
    if(this.getRemoteEntity().getFeatures().hasFeature(MateFeature.class))
    {
      MateFeature feature = this.getRemoteEntity().getFeatures().getFeature(MateFeature.class);
      baby = feature.makeBaby();
    }
    else if(this.getEntityHandle() instanceof EntityAnimal)
      baby = (LivingEntity)((EntityAnimal)this.getEntityHandle()).createChild((EntityAnimal)this.m_mate).getBukkitEntity();

    if(baby != null)
View Full Code Here

 
  @EventHandler
  public void onJoin(PlayerJoinEvent inEvent) throws Exception
  {
    RemoteEntity entity = npcManager.createNamedEntity(RemoteEntityType.Human, inEvent.getPlayer().getLocation(), "test");
    TamingFeature feature = new RemoteTamingFeature(entity);
    feature.tame(inEvent.getPlayer());
    entity.getFeatures().addFeature(feature);
    entity.getMind().addMovementDesire(new DesireFollowTamer(entity, 5, 15), entity.getMind().getHighestMovementPriority() + 1);
  }
View Full Code Here

TOP

Related Classes of de.kumpelblase2.remoteentities.persistence.EntityData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.