Esempio n. 1
0
  public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
    super.readEntityFromNBT(nbttagcompound);

    String s = nbttagcompound.getString("Owner");
    if (s.length() > 0) {
      setBotOwner(s);
    }
  }
Esempio n. 2
0
  public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
    super.writeEntityToNBT(nbttagcompound);

    if (getBotOwner() == null) {
      nbttagcompound.setString("Owner", "");
    } else {
      nbttagcompound.setString("Owner", getBotOwner());
    }
  }
Esempio n. 3
0
  public void onUpdate() {
    super.onUpdate();

    if (isWet()) {
      if (isEntityAlive()) {
        Dropper();
        health = 0;
      }
    }
  }
Esempio n. 4
0
  protected void updateEntityActionState() {
    super.updateEntityActionState();
    if (entityplayer == null) {
      entityplayer = worldObj.getPlayerEntityByName(getBotOwner());
    } else {
      float f = entityplayer.getDistanceToEntity(this);
      if (f > 7F) {

        if (entityToAttack != null && f > 14f) {
          setEntityToAttack(null);
          getPathOrWalkableBlock(entityplayer, f);
        } else {
          getPathOrWalkableBlock(entityplayer, f);
        }
      }

      if (!hasPath()) {
        if (entityToAttack == null) { // && entityToAttack == null

          List list =
              worldObj.getEntitiesWithinAABB(
                  net.minecraft.src.EntityMob.class, boundingBox.expand(16D, 3D, 16D));

          if (!list.isEmpty()) {
            setEntityToAttack(closest(list));
          } else {
            list =
                worldObj.getEntitiesWithinAABB(
                    net.minecraft.src.EntityAnimal.class, boundingBox.expand(16D, 3D, 16D));
            if (!list.isEmpty()) {
              setEntityToAttack(closest(list));
            } else {
              list =
                  worldObj.getEntitiesWithinAABB(
                      net.minecraft.src.EntitySlime.class, boundingBox.expand(16D, 3D, 16D));
              if (!list.isEmpty()) {
                setEntityToAttack(closestSlime(list));
              }
            }
          }
        } else {
          setEntityToAttack(null);
          getPathOrWalkableBlock(entityplayer, 8f); // System.out.println("is puppy lost?");
          // setPathToEntity(worldObj.getPathToEntity(this, entityToAttack, 16f));
        }
      }
    }
  }
Esempio n. 5
0
 protected void entityInit() {
   super.entityInit();
   dataWatcher.addObject(17, ""); // owner
 }