@Override
  public void initGui() {
    Keyboard.enableRepeatEvents(true);

    buttonList.clear();
    buttonList.add(
        doneButton =
            new GuiButton(
                1,
                width / 2 - 40,
                height / 2 - 10,
                80,
                20,
                MCA.getInstance().getLanguageLoader().getString("gui.button.done")));
    buttonList.add(
        randomButton =
            new GuiButton(
                2,
                width / 2 + 105,
                height / 2 - 60,
                60,
                20,
                MCA.getInstance().getLanguageLoader().getString("gui.button.random")));

    babyNameTextField =
        new GuiTextField(fontRendererObj, width / 2 - 100, height / 2 - 60, 200, 20);
    babyNameTextField.setMaxStringLength(32);
  }
  @Override
  public void drawScreen(int sizeX, int sizeY, float offset) {
    drawDefaultBackground();

    if (isMale) {
      drawCenteredString(
          fontRendererObj,
          MCA.getInstance().getLanguageLoader().getString("gui.title.namebaby.male"),
          width / 2,
          (height / 2) - 90,
          0xffffff);
    } else {
      drawCenteredString(
          fontRendererObj,
          MCA.getInstance().getLanguageLoader().getString("gui.title.namebaby.female"),
          width / 2,
          (height / 2) - 90,
          0xffffff);
    }

    drawString(
        fontRendererObj,
        MCA.getInstance().getLanguageLoader().getString("gui.title.namebaby"),
        width / 2 - 100,
        height / 2 - 70,
        0xa0a0a0);

    if (containsInvalidCharacters) {
      drawCenteredString(
          fontRendererObj,
          MCA.getInstance().getLanguageLoader().getString("gui.info.namebaby.invalidcharacters"),
          width / 2,
          (height / 2) + 20,
          0xCC0000);
    }

    babyNameTextField.drawTextBox();
    super.drawScreen(sizeX, sizeY, offset);
  }
  @Override
  protected void actionPerformed(GuiButton guibutton) {
    if (guibutton.enabled == false) {
      return;
    } else if (guibutton == doneButton) {
      WorldPropertiesManager manager =
          MCA.getInstance().playerWorldManagerMap.get(player.getCommandSenderName());

      // Assign babyName the string that is in the text field, trimmed of whitespace.
      manager.worldProperties.babyName = babyNameTextField.getText().trim();
      manager.saveWorldProperties();

      // Check if the player is married to another player.
      if (manager.worldProperties.playerSpouseID < 0) {
        MCA.packetPipeline.sendPacketToServer(new Packet(EnumPacketType.BabyInfo, manager));
      }

      // Close the GUI
      mc.displayGuiScreen(null);
    } else if (guibutton == randomButton) {
      babyNameTextField.setText(Utility.getRandomName(isMale));
      babyNameTextField.mouseClicked(5, 5, 5);
    }
  }
  @Override
  public void onUpdateServer() {
    if (MCA.getConfig().allowBlinking
        && !owner.getAI(AISleep.class).getIsSleeping()
        && owner.getHealth() > 0.0F
        && owner.usesPlayerSkin()) {
      timeSinceLastBlink++;

      if (holdingBlink) {
        timeHeldBlink++;

        if (timeHeldBlink >= 2) {
          timeHeldBlink = 0;
          holdingBlink = false;
          timeSinceLastBlink = 0;
          nextBlink = RadixMath.getNumberInRange(Time.SECOND * 2, Time.SECOND * 8);
          owner.getAI(AISleep.class).transitionSkinState(false);
        }
      } else if (timeSinceLastBlink >= nextBlink) {
        owner.getAI(AISleep.class).transitionSkinState(true);
        holdingBlink = true;
      }
    }
  }
  @Override
  public void onUpdateServer() {
    if (!MCA.getConfig().allowHuntingChore) {
      this.notifyAssigningPlayer(Color.RED + "This chore is disabled.");
      reset();
      return;
    }

    if (standPoint.iPosX == 0 && standPoint.iPosY == 0 && standPoint.iPosZ == 0) {
      // Find a point to stand at and hunt.
      List<Point3D> grassBlocks = RadixLogic.getNearbyBlocks(owner, Blocks.grass, 15);

      if (grassBlocks.size() > 0) {
        standPoint = grassBlocks.get(RadixMath.getNumberInRange(0, grassBlocks.size() - 1));
      } else {
        owner.say("hunting.badspot", getAssigningPlayer());
        reset();
      }

      return;
    }

    if (RadixMath.getDistanceToXYZ(owner, standPoint) >= 5.0F && owner.getNavigator().noPath()) {
      boolean successful =
          owner
              .getNavigator()
              .tryMoveToXYZ(standPoint.dPosX, standPoint.dPosY, standPoint.dPosZ, owner.getSpeed());

      if (!successful) {
        owner.say("hunting.badspot", getAssigningPlayer());
        reset();
      }
    } else if (RadixMath.getDistanceToXYZ(owner, standPoint) < 5.0F) {
      ticksActive++;

      if (ticksActive >= Time.SECOND * 20) {
        boolean doSpawn = owner.worldObj.rand.nextBoolean();

        if (doSpawn) {
          try {
            final Class entityClass = RegistryMCA.getRandomHuntingEntity(isTaming);
            final EntityLiving entity =
                (EntityLiving)
                    entityClass.getDeclaredConstructor(World.class).newInstance(owner.worldObj);
            final List<Point3D> nearbyGrass = RadixLogic.getNearbyBlocks(owner, Blocks.grass, 3);
            final Point3D spawnPoint =
                nearbyGrass.get(owner.worldObj.rand.nextInt(nearbyGrass.size()));

            if (spawnPoint != null) {
              entity.setPosition(spawnPoint.iPosX, spawnPoint.iPosY + 1, spawnPoint.iPosZ);
            }

            owner.worldObj.spawnEntityInWorld(entity);

            if (!isTaming) {
              entity.attackEntityFrom(DamageSource.generic, 100.0F);
              owner.swingItem();
            }
          } catch (Exception e) {
            RadixExcept.logErrorCatch(
                e,
                "There was an error spawning an entity for the hunting AI. If you are using a mod that expands MCA's hunting AI, it is likely the problem!");
          }
        }

        List<Entity> nearbyItems =
            RadixLogic.getAllEntitiesOfTypeWithinDistance(EntityItem.class, owner, 5);

        if (nearbyItems.size() != 0) {
          for (Entity entity : nearbyItems) {
            EntityItem item = (EntityItem) entity;
            ItemStack stack = item.getEntityItem();

            addItemStackToInventory(stack);
            item.setDead();
          }
        }

        ticksActive = 0;
      }
    }
  }
 public PlayerInfo(EntityPlayer player) {
   this.playerInstance = player;
   this.playerManager =
       MCA.getInstance().playerWorldManagerMap.get(playerInstance.getCommandSenderName());
   this.playerPropertiesList = MCA.getInstance().getWorldProperties(playerManager);
 }
 public PlayerInfo(World world, String playerName) {
   this.playerInstance = world.getPlayerEntityByName(playerName);
   this.playerManager =
       MCA.getInstance().playerWorldManagerMap.get(playerInstance.getCommandSenderName());
   this.playerPropertiesList = MCA.getInstance().getWorldProperties(playerManager);
 }