Package net.minecraft.entity

Examples of net.minecraft.entity.EntityCreature


                    {
                        if (!(entry instanceof EntityCreature))
                        {
                            continue;
                        }
                        EntityCreature e = (EntityCreature) entry;
                        //Check whether the mob can actually *see* the arclamp tile
                        //if (this.worldObj.func_147447_a(thisPos, Vec3.createVectorHelper(e.posX, e.posY, e.posZ), true, true, false) != null) continue;

                        Vec3 vecNewTarget = RandomPositionGenerator.findRandomTargetBlockAwayFrom(e, 16, 7, this.thisPos);
                        if (vecNewTarget == null)
                        {
                            continue;
                        }
                        PathNavigate nav = e.getNavigator();
                        if (nav == null)
                        {
                            continue;
                        }
                        Vec3 vecOldTarget = null;
                        if (nav.getPath() != null && !nav.getPath().isFinished())
                        {
                            vecOldTarget = nav.getPath().getPosition(e);
                        }
                        double distanceNew = vecNewTarget.squareDistanceTo(this.xCoord, this.yCoord, this.zCoord);

                        if (distanceNew > e.getDistanceSq(this.xCoord, this.yCoord, this.zCoord))
                        {
                            if (vecOldTarget == null || distanceNew > vecOldTarget.squareDistanceTo(this.xCoord, this.yCoord, this.zCoord))
                            {
                                e.getNavigator().tryMoveToXYZ(vecNewTarget.xCoord, vecNewTarget.yCoord, vecNewTarget.zCoord, 0.3D);
                                //System.out.println("Debug: Arclamp repelling entity: "+e.getClass().getSimpleName());
                            }
                        }
                    }
                }
View Full Code Here


            @SuppressWarnings("unchecked")
            List<Entity> entityList = ((EntityPlayer) getParent()).getEntityWorld().getEntitiesWithinAABBExcludingEntity(getParent(), getParent().boundingBox.expand(radius, radius, radius));
            if (!entityList.isEmpty()) {
                for (Entity entity : entityList) {
                    if (entity instanceof EntityCreature) {
                        EntityCreature creature = (EntityCreature) entity;
                        for(Class clz : classList)
                        {
                            if(clz.isInstance(creature))
                            {
                                boolean canRun = false;
                                Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockAwayFrom(creature, 16, 7, Vec3.createVectorHelper(getParent().posX, getParent().posY, getParent().posZ));
                                if(vec3 != null && !(getParent().getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < getParent().getDistanceSqToEntity(creature)))
                                {
                                    PathEntity newPath = new PathEntity(new PathPoint[] { new PathPoint((int)vec3.xCoord, (int)vec3.yCoord, (int)vec3.zCoord) });
                                    creature.getNavigator().setPath(newPath, 1D);
                                    canRun = true;
                                }
                                if(canRun)
                                    creature.getNavigator().setSpeed(runSpeed);
                            }
                        }
                    }
                }
            }
View Full Code Here

                    z = 0.5 + parseDouble(sender, args[4], sender.posZ);
                }
            }
            for (int i = 0; i < amount; i++)
            {
                EntityCreature mob = (EntityCreature) EntityList.createEntityByName(mobNames.get(args[0].toLowerCase()), sender.worldObj);
                if (mob == null)
                {
                    OutputHandler.chatError(sender, String.format("%s was not recognized as a mob.", args[0]));
                    return;
                }
                if (args[0].toLowerCase().equals("witherskeleton") || args[0].toLowerCase().equals("wskeleton") || args[0].toLowerCase().equals("wskele"))
                {
                  // Better safe than sorry...
                  if (mob instanceof EntitySkeleton) {
                    ((EntitySkeleton)mob).setSkeletonType(1);
                  }
                }
                if (mob instanceof EntityLiving) {
                  ((EntityLiving)mob).onSpawnWithEgg((IEntityLivingData)null);
                }
                mob.setPosition(x, y, z);
                sender.worldObj.spawnEntityInWorld(mob);
                if (args.length >= 3 && args[1].equalsIgnoreCase("name")) {
                  StringBuilder sb = new StringBuilder();
                  for(int index = 2; index < args.length; index++)
                  {
                    sb.append(" " + args[index]);
                  }
                  mob.setCustomNameTag(sb.toString());
                }
                mob.spawnExplosionParticle();
            }
        }
        else
        {
            OutputHandler.chatError(sender, "Improper syntax.");
View Full Code Here

            dimension = parseInt(sender, args[5]);
           
            for (int i = 0; i < amount; i++)
            {
                World world = DimensionManager.getWorld(dimension);
                EntityCreature mob = (EntityCreature) EntityList.createEntityByName(mobNames.get(args[0].toLowerCase()), world);
                if (mob == null)
                {
                    OutputHandler.chatError(sender, String.format("%s was not recognized as a mob.", args[0]));
                    return;
                }
                if (args.length >= 6) {
                  StringBuilder sb = new StringBuilder();
                  for(int index = 6; index < args.length; index++)
                  {
                    sb.append(" " + args[index]);
                  }
                  mob.setCustomNameTag(sb.toString());
                }
                if (mob instanceof EntityLiving) {
                  ((EntityLiving)mob).onSpawnWithEgg((IEntityLivingData)null);
                }
                mob.setPosition(x, y, z);
                world.spawnEntityInWorld(mob);
                mob.spawnExplosionParticle();
            }
        }
        else
        {
            OutputHandler.chatError(sender, "Improper syntax.");
View Full Code Here

  @Override
  public ItemStack[] getLootDrop(IEntityButterfly entity, boolean playerKill, int lootLevel) {
    ArrayList<ItemStack> drop = new ArrayList<ItemStack>();

    EntityCreature creature = entity.getEntity();
    float metabolism = (float)getGenome().getMetabolism() / 10;

    for (Map.Entry<ItemStack, Float> entry : getGenome().getPrimary().getButterflyLoot().entrySet())
      if (creature.worldObj.rand.nextFloat() < entry.getValue() * metabolism)
        drop.add(entry.getKey().copy());
 
View Full Code Here

TOP

Related Classes of net.minecraft.entity.EntityCreature

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.