예제 #1
0
  /**
   * Performs the thirst changes for the specified player
   *
   * @param username player to handle
   */
  private void handleThirst(String username) {
    int playerThirst = thirstMap.get(username);
    EntityPlayer player = mc.thePlayer;

    if (player == null || player.isDead || player.capabilities.isCreativeMode) {
      return;
    } else if (playerThirst == 20000) {
      if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
        ChatHandler.chatWarning(player, "I should find some water...");
      }
      playerThirst++;
    } else if (playerThirst == 18000) {
      if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
        ChatHandler.chatWarning(player, "I feel quite thirsty now...");
      }
      playerThirst++;
    } else if (playerThirst == 16000) {
      if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
        ChatHandler.chatWarning(player, "My mouth feels a little dry...");
      }
      playerThirst++;
    } else if (playerThirst >= 24000
        && FMLCommonHandler.instance().getMinecraftServerInstance().getTickCounter() % 40 == 0) {
      player.attackEntityFrom(DamageType.thirstDeath, 1);
    } else if (player.isSprinting() || player.isAirBorne) {
      playerThirst = playerThirst + 2;
    } else {
      playerThirst++;
    }
    ChatHandler.logDebug(String.valueOf(playerThirst));
    thirstMap.put(username, playerThirst);
  }
예제 #2
0
 /**
  * Subtracts the thirst for the specified player Used on drinking
  *
  * @param player
  * @param amount
  */
 public void subtractThirst(EntityPlayer player, int amount) {
   int playerThirst = thirstMap.get(player.getDisplayName());
   playerThirst = playerThirst - amount;
   if (playerThirst < 0) {
     playerThirst = 0;
   }
   thirstMap.put(player.getDisplayName(), playerThirst);
   if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
     ChatHandler.chatConfirmation(player, "Ahh, much better.");
   }
 }